How to get 2 images attached to layout bottom

2019-03-03 09:26发布

I want to attach 2 images 1st at left bottom corner and other on right bottom corner but I want that images to be hardcore in bottom so that if I scroll the page the images should remain at the same place

3条回答
我想做一个坏孩纸
2楼-- · 2019-03-03 09:41
<RelativeLayout >
   <ScrollView >

   </scrollView>

  <RelativeLayout android:layout_alighParentBottom=true abdroid:backgrond=@color/transparnt">

    <Button >
    </Button >

    <Button android:layout_alighParentRight=true>
    </Button >

  <RelativeLayout >
</RelativeLayout >
查看更多
女痞
3楼-- · 2019-03-03 09:51

Something like:

<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/linearLayout1"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

   <ImageView 
       android:id="@+id/nvContent"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:src="@drawable/icon"
       android:layout_alignParentBottom="true"
       android:layout_alignParentLeft="true" />

    <ImageView 
       android:id="@+id/nvContent"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:src="@drawable/icon"
       android:layout_alignParentBottom="true"
       android:layout_alignParentRight="true" />

</RelativeLayout>
查看更多
Explosion°爆炸
4楼-- · 2019-03-03 09:53

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); 
查看更多
登录 后发表回答