1

I have a FrameLayout with two LinearLayouts inside. For Android version 4.x it works fine but for version 2.3 second LinearLayout doesn't fill FrameLayout vertically. Can anyone tell me why? Btw I know I set second LinearLayout as invisible but I show it up later in code :)

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/list_left_border">

    <LinearLayout
       android:layout_width="match_parent"
       android:layout_height="match_parent"
       android:id="@+id/maincontrols"
        android:orientation="horizontal">

        <LinearLayout
            android:layout_width="0dp"
            android:layout_weight="85"
            android:layout_height="match_parent"
            android:orientation="vertical">
                <TextView
                    android:id="@+id/textView1"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="@dimen/left_border_grey_width"
                    android:layout_marginStart="@dimen/left_border_grey_width"
                    android:layout_marginTop="10dp"
                    android:textSize="@dimen/choose_level_list_item_name_text_size"
                    android:textColor="#ff0000"
                    android:paddingLeft="5dp" />

                <TextView
                    android:id="@+id/textView2"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="10dp"
                    android:textSize="@dimen/choose_level_list_item_description_text_size"
                    android:paddingLeft="5dp"
                    android:layout_marginLeft="@dimen/left_border_grey_width"
                    android:layout_marginStart="@dimen/left_border_grey_width"/>
        </LinearLayout>

        <RelativeLayout
            android:layout_width="0dp"
            android:layout_weight="15"
            android:layout_height="match_parent"
            android:layout_gravity="center_vertical"
            android:gravity="center_vertical"
            android:id="@+id/progressBarContainer">


        </RelativeLayout>

    </LinearLayout>

    <LinearLayout
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/buttons"
        android:visibility="invisible"
        android:alpha="0.7" >

        <Button
            android:layout_width="0dp"
            android:layout_height="fill_parent"
            android:layout_weight=".45"
            android:text="@string/learn2"
            android:id="@+id/buttonLearn"
            android:layout_marginTop="0dp"
            android:background="@drawable/button_learn_border"
            android:layout_marginRight="10dp"
            android:layout_marginEnd="10dp"
            android:textColor="#000000"
            android:gravity="center" />

        <Button
            android:layout_width="0dp"
            android:layout_height="fill_parent"
            android:layout_weight=".45"
            android:text="@string/test2"
            android:id="@+id/buttonTest"
            android:background="@drawable/button_test_bg"
            android:textColor="#000000"
            android:layout_marginTop="0dp"
            android:gravity="center" />

    </LinearLayout>

</FrameLayout>
dammarpol
  • 77
  • 1
  • 13
  • Did you try using `fill_parent` instead of `match_parent`? Double check the minimum SDK for your app. – Musa Y. Jun 09 '15 at 09:44
  • fill_parent instead of all match_parents or just for second linear layout? – dammarpol Jun 09 '15 at 09:51
  • Try changing all of them. That's the only thing that I can think of. Therefore, I asked you to check the min SDK for you app.. For more info read http://stackoverflow.com/questions/5761960/what-is-the-difference-between-match-parent-and-fill-parent – Musa Y. Jun 09 '15 at 09:56
  • i have set minSdk as 10 , I need it to support Android 2.3 – dammarpol Jun 09 '15 at 10:05
  • If that's the case, setup minSdk to 9 (because Android 2.3–2.3.2 Gingerbread = API level 9).. and what I suggested earlier about using `fill_parent` is irrelevant as for API 8+ you should use `match_parent` – Musa Y. Jun 09 '15 at 10:14
  • puffff, I cant change for API level 9 cos Facebook SDK which i use need API level at least 10... – dammarpol Jun 09 '15 at 10:31

0 Answers0