本文介绍了如何将2张图片附加到版面底部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我要附加2张图片第一个在左下角,另一个在右下角但我希望这些图片在底部具有硬核,以便在滚动页面时,这些图片应保留在同一位置
I want to attach 2 images1st at left bottom corner and other on right bottom cornerbut I want that images to be hardcore in bottom so that if I scroll the page the images should remain at the same place
推荐答案
动态地,我成功地回答了我自己的问题,因此我在此为所有用户提供了代码,并且使代码起作用并拥有
Dynamically ,i am succesful to answer my own question so i m hereby putting the code for all the user and it works so have the code and enjoy
LinearLayout llMain=new LinearLayout(this);
llMain.setOrientation(LinearLayout.VERTICAL);
llMain.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT));
llMain.setBackgroundColor(Color.WHITE);
LinearLayout llLsView=new LinearLayout(this);
llLsView.setOrientation(LinearLayout.VERTICAL);
llLsView.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT,1.0F));
//llLsView.setPadding(0,0,0,20);
LinearLayout llImage=new LinearLayout(this);
llImage.setOrientation(LinearLayout.HORIZONTAL);
llImage.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT));
llImage.setBackgroundColor(Color.BLACK);
LinearLayout llHome=new LinearLayout(this);
//llHome.setOrientation(LinearLayout.HORIZONTAL);
llHome.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.FILL_PARENT,0.5F));
llHome.setPadding(0,0,5,0);
llHome.setGravity(Gravity.RIGHT);
ImageView imgHome=new ImageView(this);
imgHome.setImageResource(R.drawable.home);
llHome.addView(imgHome);
LinearLayout llBack=new LinearLayout(this);
//llBack.setOrientation(LinearLayout.HORIZONTAL);
llBack.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.FILL_PARENT,0.5F));
llBack.setPadding(5,0,0,0);
llBack.setGravity(Gravity.LEFT);
ImageView imgBack=new ImageView(this);
imgBack.setImageResource(R.drawable.back);
llBack.addView(imgBack);
llImage.addView(llBack);
llImage.addView(llHome);
llMain.addView(llLsView);
llMain.addView(llImage);
setContentView(llMain);
这篇关于如何将2张图片附加到版面底部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!