I Can't Show Linearlayout At Bottom To Scroll View
Solution 1:
<?xml version="1.0" encoding="utf-8"?><RelativeLayoutxmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="fill_parent"android:layout_height="fill_parent"android:background="@drawable/background"android:orientation="vertical" ><RelativeLayoutandroid:id="@+id/reltop"android:layout_width="fill_parent"android:layout_height="wrap_content"android:layout_alignParentTop="true"android:background="@drawable/title" ></RelativeLayout><ScrollViewandroid:layout_below="@id/reltop"android:layout_above="@id/add_layer"android:layout_width="fill_parent"android:layout_height="wrap_content"android:scrollbars="none"><RelativeLayoutandroid:id="@+id/rel2"android:layout_width="fill_parent"android:layout_height="wrap_content" ><Buttonandroid:id="@+id/button1"android:layout_width="250dp"android:layout_height="50dp"android:layout_centerHorizontal="true"android:layout_marginTop="10dp"android:background="@drawable/bkg_gold_btn"android:text="Button 1" />
/*--------------------------------*/
/* there are 12 more Buttons Here */
/*--------------------------------*/
<Buttonandroid:id="@+id/button10"android:layout_width="250dp"android:layout_height="50dp"android:layout_below="@+id/button9"android:layout_centerHorizontal="true"android:layout_marginBottom="10dp"android:layout_marginTop="5dp"android:background="@drawable/bkg_gold_btn"android:text="Button 14" /></RelativeLayout></ScrollView><LinearLayoutandroid:id="@+id/add_layer"android:layout_width="fill_parent"android:layout_alignParentBottom="true"android:layout_height="50dip"
></LinearLayout></RelativeLayout>
Solution 2:
You cant see this LinearLayout coz, Parent LinearLayout is not Scrollable, and Scrollview is covering all the screen, to solve this situation, you have two options, either fix the height of ScrollView to some fixed part of the screen using weight, or pixels. Or have RelativeLayout as parent of LinearLayout and Scrollview. Set LinearLayout at bottom of parent, and scroll view aboue of LinearLayout.
Solution 3:
Add android:gravity="bottom" android:layout_gravity="bottom"
inside LinearLayout and try adding components in LinearLayout.
or replace that linear layout by relative layout like this :
<RelativeLayoutandroid:layout_width="fill_parent"android:layout_height="wrap_content"android:gravity="bottom" ><Button... /></RelativeLayout>
Solution 4:
The Bottom LinearLayout is not visible to you, might be because of the ScrollView is takes the remaining space of the Screen to show that n numbers of button in it cause you gave it height of wrap_content.
You can use weightSum
attributr of LinearLayout to define that how much area of screen will be covered by the view.
<?xml version="1.0" encoding="utf-8"?><LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="fill_parent"android:layout_height="fill_parent"android:weightSum="10"android:background="@drawable/background"android:orientation="vertical" ><RelativeLayoutandroid:layout_width="fill_parent"android:layout_weight="1"android:layout_height="0dp"android:background="@drawable/title" ></RelativeLayout><ScrollViewandroid:layout_width="fill_parent"android:layout_weight="8"android:layout_height="0dp"android:scrollbars="none"><RelativeLayoutandroid:id="@+id/rel2"android:layout_width="fill_parent"android:layout_height="fill_parent" ></RelativeLayout></ScrollView><LinearLayoutandroid:id="@+id/add_layer"android:layout_width="fill_parent"android:layout_weight="1"android:layout_height="0dp"
></LinearLayout></LinearLayout>
Solution 5:
You can move the bottom LinearLayout to the bottom of RelativeLayout(id/rel2), then you'll see it
Post a Comment for "I Can't Show Linearlayout At Bottom To Scroll View"