Skip to content Skip to sidebar Skip to footer

Overlapping In Relativelayout

I have one RelativeLayout which contains 2 linearlayouts, one should always be aligned with bottom (for log out purpose.) and the other starts from top and contains 2 viewstubs. Th

Solution 1:

Use 3 LinearLayouts set the center layout as it is which you have done above/below and add that centered layout into scroll view after it still your problem do not solve so just let me know :) Happy coding.

Solution 2:

you don't say anything about position of two subviews. So, I mean each view has with = 1/2 screen. Just try my solution.

abc.xml:

<LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android"android:orientation="vertical"android:layout_width="match_parent"android:layout_height="match_parent"android:weightSum="10"><LinearLayoutandroid:layout_width="match_parent"android:layout_height="0dp"android:layout_weight="8"android:orientation="horizontal"android:weightSum="2"android:background="#116611"><LinearLayoutandroid:layout_width="0dp"android:layout_height="match_parent"android:background="#116611"android:layout_weight="1"><ScrollViewandroid:id="@+id/scrollView1"android:layout_width="match_parent"android:layout_height="match_parent"><LinearLayoutandroid:id="@+id/ll_insideScroll1"android:orientation="vertical"android:layout_width="match_parent"android:layout_height="match_parent"></LinearLayout></ScrollView></LinearLayout><LinearLayoutandroid:layout_width="0dp"android:layout_height="match_parent"android:background="#118811"android:layout_weight="1"><ScrollViewandroid:id="@+id/scrollView2"android:layout_width="match_parent"android:layout_height="match_parent"></ScrollView></LinearLayout></LinearLayout><!--Bottom LinearLayout--><LinearLayoutandroid:layout_width="match_parent"android:layout_height="0dp"android:background="#113311"android:layout_weight="2"></LinearLayout></LinearLayout>

and for test this layout:

protectedvoidonCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.abc);
        LinearLayoutll_insideScroll1= (LinearLayout)findViewById(R.id.ll_insideScroll1);
        for(inti=0; i < 50;i++){
            TextViewv=newTextView(this);
            v.setText("TextView "+i);
            ll_insideScroll1.addView(v,i);
        }
    }

Post a Comment for "Overlapping In Relativelayout"