Hi,
As you can see from the image above, the parent LinearLayout is not filling until the bottom of the scroll view (in blue). I chose to put the scroll view at the bottom because the LinearLayout has a ListView.
XML:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<ImageView
android:id="#+id/finalImg"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:src="#drawable/image_01_big" />
<RelativeLayout
android:id="#+id/imgFinal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" >
</RelativeLayout>
<LinearLayout
android:id="#+id/linearLayoutInfoTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/imgFinal"
android:layout_centerHorizontal="true"
android:orientation="vertical" >
<TextView
android:id="#+id/finalInfoTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="infoTitle"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayoutInfo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/imgFinal"
android:layout_marginTop="20dp"
android:orientation="horizontal" >
<TextView
android:id="#+id/finalInfoDesc"
android:layout_width="match_parent"
android:layout_height="84dp"
android:gravity="center"
android:text="infoDesc"
android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayoutInfo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/imgFinal"
android:layout_marginTop="20dp"
android:orientation="horizontal" >
<TextView
android:id="#+id/finalLineUpStatic"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Line Up"
android:textStyle="bold"
android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>
<ListView
android:id="#+id/finalListView"
android:layout_width="match_parent"
android:layout_height="150dp"
android:layout_above="#+id/Scroll"
android:layout_below="#+id/linearLayoutInfo"
android:layout_centerHorizontal="true"
android:layout_weight=".94"
android:fadeScrollbars="false" >
</ListView>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true"
>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<LinearLayout
android:id="#+id/Lin_Scroll"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<RelativeLayout
android:id="#+id/Rel_Scroll"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<RelativeLayout
android:id="#+id/Rel_add_gps"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_marginBottom="65dp" >
<RelativeLayout
android:id="#+id/RelGPS"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_toRightOf="#+id/RelAddress" >
<TextView
android:id="#+id/finalGPSStatic"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:gravity="center"
android:text="GPS"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textStyle="bold" />
<TextView
android:id="#+id/finalGPS"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/finalGPSStatic"
android:layout_below="#+id/finalGPSStatic"
android:gravity="center"
android:text="click"
android:textAppearance="?android:attr/textAppearanceMedium" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/RelAddress"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true" >
<TextView
android:id="#+id/finalAddressStatic"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:gravity="center"
android:text="Address"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textStyle="bold" />
<TextView
android:id="#+id/finalAddress"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/finalAddressStatic"
android:layout_below="#+id/finalAddressStatic"
android:gravity="center"
android:text="not static"
android:textAppearance="?android:attr/textAppearanceMedium" />
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
android:id="#+id/Rel_ven_dat"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/Rel_add_gps"
android:layout_alignParentLeft="true"
android:layout_marginBottom="22dp"
android:background="#color/gray"
>
<RelativeLayout
android:id="#+id/RelDate"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_toRightOf="#+id/RelVenue"
android:background="#color/blue"
>
<TextView
android:id="#+id/finalDateStatic"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:gravity="center"
android:text="Date"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textStyle="bold" />
<TextView
android:id="#+id/finalDate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/finalDateStatic"
android:layout_below="#+id/finalDateStatic"
android:gravity="center"
android:text="not static"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/finalTime"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/finalDateStatic"
android:layout_below="#+id/finalDate"
android:gravity="center"
android:text="not static"
android:textAppearance="?android:attr/textAppearanceMedium" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/RelVenue"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true" >
<TextView
android:id="#+id/finalVenueStatic"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:gravity="center"
android:text="not static"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textStyle="bold" />
<TextView
android:id="#+id/finalVenue"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/finalVenueStatic"
android:layout_below="#+id/finalVenueStatic"
android:gravity="center"
android:text="not static"
android:textAppearance="?android:attr/textAppearanceMedium" />
</RelativeLayout>
</RelativeLayout>
</RelativeLayout>
</LinearLayout>
<ProgressBar
android:id="#+id/progressBar2"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<RelativeLayout
android:id="#+id/RelButtonTop"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="2.45" >
<Button
android:id="#+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="42dp"
android:text="Button" />
<Button
android:id="#+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginRight="54dp"
android:text="Button" />
<RelativeLayout
android:id="#+id/RelativeLayout01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_weight="2.45" >
<Button
android:id="#+id/Button01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="42dp"
android:text="Button" />
<Button
android:id="#+id/Button02"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginRight="54dp"
android:text="Button" />
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
android:id="#+id/RelativeLayout02"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="2.45" >
<Button
android:id="#+id/Button03"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="42dp"
android:text="Button" />
<Button
android:id="#+id/Button04"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginRight="54dp"
android:text="Button" />
</RelativeLayout>
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Button 11" />
</LinearLayout>
</ScrollView>
</LinearLayout>
Related
Sorry for my english. I have background image, if keyboard show is resize background image. If keyboard not show evrithing work fine.
sorry obout image i have not 15 reputation
Its normal condition: image
Its if keyboard is show: image, background image is resize
Its if i in manifest i write adjustPan image
Bellow my xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="match_parent"
android:background="#9a5f35"
android:layout_height="50dp" >
<LinearLayout
android:id="#+id/edit_profile"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical" >
</LinearLayout>
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_marginTop="10dp"
android:layout_weight="1"
android:text="Получить бонус"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#fff"
android:textSize="20sp" />
<RelativeLayout
android:id="#+id/backDd"
android:layout_width="100dp"
android:layout_height="50dp" >
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:src="#drawable/back_arraund" />
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="bottom" >
<ScrollView
android:id="#+id/scroll"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true"
android:fadingEdge="none" >
<ImageView
android:id="#+id/imageView21"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:src="#drawable/bg_shkaf" />
</ScrollView>
<ScrollView
android:id="#+id/scrollView1"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="40dp"
android:orientation="vertical" >
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="1) Введите сумму вашего счета"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#fff"
android:textSize="20dp" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="2) Сгенерируйте код"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#fff"
android:textSize="20dp" />
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="3) Покажите код официанту"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#fff"
android:textSize="20dp" />
<TextView
android:id="#+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="4) Получите бонус на счет"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#fff"
android:textSize="20dp" />
</LinearLayout>
<TextView
android:id="#+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="30dp"
android:gravity="center"
android:lineSpacingMultiplier="1.2"
android:text="Бонусы дают привликательную возможность\nполучть скидки и обменивать их на подарки\nот нашего кафе.Получайте как можно больше\nбонусов, для более ценных подарков"
android:textColor="#d2d3ce"
android:textSize="13dp"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="80dp"
android:orientation="horizontal" >
<TextView
android:id="#+id/textView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:layout_marginRight="5dp"
android:text="Введите сумму:"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#fff"
android:textSize="20dp" />
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1" >
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_marginRight="10dp"
android:background="#drawable/button_radius_get_bonus"
android:gravity="center_vertical" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<EditText
android:id="#+id/summgrn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="5dp"
android:hint="1200"
android:inputType="number"
android:maxLines="1"
android:maxLength="5"
android:background="#null"
android:textColor="#fff"
android:textColorHint="#91623f" >
<requestFocus />
</EditText>
<TextView
android:id="#+id/textView8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="5dp"
android:layout_marginRight="20dp"
android:layout_weight="1"
android:text="грн."
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#fff"
android:textSize="20dp" />
</LinearLayout>
</RelativeLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="#+id/textView9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="5dp"
android:layout_marginTop="1dp"
android:text="и покажите официанту код"
android:textColor="#fff"
/>
<ImageView
android:id="#+id/registrationsdasdad"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="1dp"
android:layout_marginTop="1dp"
android:src="#drawable/review_button"
android:visibility="invisible" />
<TextView
android:id="#+id/textView102"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="50dp"
android:layout_marginTop="1dp"
android:text="Мы очень старались - оцените нас!"
android:textColor="#fff"
android:visibility="invisible" />
</LinearLayout>
</LinearLayout>
</ScrollView>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >
</LinearLayout>
<ImageView
android:id="#+id/imageView212"
android:layout_width="300dp"
android:layout_height="300dp"
android:layout_centerHorizontal="true"
android:scaleType="centerCrop"
android:layout_marginTop="10dp"
android:visibility="invisible"
android:src="#drawable/image_8" />
<RelativeLayout
android:id="#+id/generateBonus"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_gravity="bottom"
android:background="#9a5f35"
android:gravity="center_horizontal"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
<TextView
android:id="#+id/textView10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="Получить"
android:textColor="#fff"
android:textSize="20dp" />
</RelativeLayout>
</RelativeLayout>
</LinearLayout>
I'm not sure why but in my linearlayout android:layout_below= Does Not Set TextViews Below ImageButtons.
I know I've overlooked something but I'm not sure exactly what that might be.
Any suggestions are appreciated.
<?xml version="1.0" encoding="UTF-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/layout1"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:weightSum="1" >
<View
android:id="#+id/view1"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="0.3" />
<ImageButton
android:id="#+id/photos"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.1"
android:src="#drawable/photos" />
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/photos"
android:layout_marginTop="17dp"
android:text="Large Text"
android:textAppearance="?android:attr/textAppearanceLarge" />
<ImageButton
android:id="#+id/audio"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.1"
android:src="#drawable/audio" />
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/audio"
android:layout_marginTop="17dp"
android:text="Large Text"
android:textAppearance="?android:attr/textAppearanceLarge" />
<ImageButton
android:id="#+id/written"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.1"
android:src="#drawable/written" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/written"
android:layout_marginTop="17dp"
android:text="Large Text"
android:textAppearance="?android:attr/textAppearanceLarge" />
<ImageButton
android:id="#+id/video"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.1"
android:src="#drawable/video" />
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/video"
android:layout_marginTop="17dp"
android:text="Large Text"
android:textAppearance="?android:attr/textAppearanceLarge" />
<View
android:id="#+id/view1"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="0.3" />
</LinearLayout>
<ImageView
android:id="#+id/imageView1"
android:layout_width="800dp"
android:layout_height="100dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="48dp"
android:src="#drawable/icon_e" />
</RelativeLayout>
Try this..
android:layout_below is only for RelativeLayout not for LinearLayout
<?xml version="1.0" encoding="UTF-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/layout1"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true" >
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical" >
<ImageButton
android:id="#+id/photos"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:src="#drawable/photos" />
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="17dp"
android:gravity="center"
android:text="Large Text"
android:textAppearance="?android:attr/textAppearanceLarge" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical" >
<ImageButton
android:id="#+id/audio"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:src="#drawable/audio" />
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="17dp"
android:gravity="center"
android:text="Large Text"
android:textAppearance="?android:attr/textAppearanceLarge" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical" >
<ImageButton
android:id="#+id/written"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:src="#drawable/written" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="17dp"
android:gravity="center"
android:text="Large Text"
android:textAppearance="?android:attr/textAppearanceLarge" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical" >
<ImageButton
android:id="#+id/video"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:src="#drawable/video" />
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="17dp"
android:gravity="center"
android:text="Large Text"
android:textAppearance="?android:attr/textAppearanceLarge" />
</LinearLayout>
</LinearLayout>
<ImageView
android:id="#+id/imageView1"
android:layout_width="800dp"
android:layout_height="100dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="48dp"
android:src="#drawable/icon_e" />
</RelativeLayout>
android:layout_below only works inside the RelativeLayout
You have to use RalativeLayout instead of LinearLayout.
LinearLayout can not allow layout_below property.
Put each related ImageButton and TextView into another LinearLayout with android:orientation="vertical" as follows...
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >
<ImageButton
android:id="#+id/photos"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/photos" />
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/photos"
android:layout_marginTop="17dp"
android:text="Large Text"
android:textAppearance="?android:attr/textAppearanceLarge" />
</LinearLayout>
So, your updated layout can be as follows...
<?xml version="1.0" encoding="UTF-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/layout1"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:gravity="center"
android:orientation="horizontal"
android:weightSum="1" >
<LinearLayout
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="0.2"
android:orientation="vertical" >
<ImageButton
android:id="#+id/photos"
android:layout_width="wrap_content"
android:layout_height="0dip"
android:layout_weight="1"
android:src="#drawable/photos" />
<TextView
android:id="#+id/textView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="17dp"
android:text="Large Text"
android:textAppearance="?android:attr/textAppearanceLarge" />
</LinearLayout>
<LinearLayout
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="0.2"
android:orientation="vertical" >
<ImageButton
android:id="#+id/audio"
android:layout_width="wrap_content"
android:layout_height="0dip"
android:layout_weight="1"
android:src="#drawable/audio" />
<TextView
android:id="#+id/textView2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="17dp"
android:text="Large Text"
android:textAppearance="?android:attr/textAppearanceLarge" />
</LinearLayout>
<LinearLayout
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="0.2"
android:orientation="vertical" >
<ImageButton
android:id="#+id/written"
android:layout_width="wrap_content"
android:layout_height="0dip"
android:layout_weight="1"
android:src="#drawable/written" />
<TextView
android:id="#+id/textView3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="17dp"
android:text="Large Text"
android:textAppearance="?android:attr/textAppearanceLarge" />
</LinearLayout>
<LinearLayout
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="0.2"
android:orientation="vertical" >
<ImageButton
android:id="#+id/video"
android:layout_width="wrap_content"
android:layout_height="0dip"
android:layout_weight="1"
android:src="#drawable/video" />
<TextView
android:id="#+id/textView4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="17dp"
android:text="Large Text"
android:textAppearance="?android:attr/textAppearanceLarge" />
</LinearLayout>
</LinearLayout>
<ImageView
android:id="#+id/imageView1"
android:layout_width="800dp"
android:layout_height="100dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="48dp"
android:src="#drawable/icon_e" />
</RelativeLayout>
I want to keep the adview layout at bottom in linear layout. i tried using gravity and layout_gravity at bottom but its not working,i had attached the code and snapshot too.
please give me any solution
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:id="#+id/linearmainlayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#drawable/inner_screen_bg"
android:orientation="vertical"
android:weightSum="10" >
<LinearLayout
android:id="#+id/linear1"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="4"
android:orientation="horizontal"
android:paddingBottom="10dip"
android:paddingTop="5dip"
android:weightSum="100" >
<LinearLayout
android:layout_width="0dip"
android:layout_height="match_parent"
android:layout_weight="20"
android:gravity="center_vertical"
android:orientation="vertical" >
<Button
android:id="#+id/fbShare"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="#drawable/fb_btn"
android:textAppearance="?android:attr/textAppearanceSmall" />
<Button
android:id="#+id/twitterShare"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="#drawable/tw_btn"
android:textAppearance="?android:attr/textAppearanceSmall" />
<Button
android:id="#+id/revealButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="#drawable/reveal_btn"
android:textAppearance="?android:attr/textAppearanceSmall" />
</LinearLayout>
<RelativeLayout
android:id="#+id/imageContainer"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal"
android:layout_marginRight="10dip"
android:layout_marginTop="3dp"
android:layout_weight="60"
android:orientation="vertical" >
<RelativeLayout
android:id="#+id/imageView"
android:layout_width="320dip"
android:layout_height="150dip"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:background="#drawable/image5" >
<ImageView
android:id="#+id/correctMark"
android:layout_width="80dip"
android:layout_height="80dip"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_marginBottom="10dip"
android:layout_marginLeft="5dip"
android:src="#drawable/cleared_imag"
android:visibility="gone" />
</RelativeLayout>
</RelativeLayout>
<LinearLayout
android:id="#+id/ticketCounterContainer"
android:layout_width="0dip"
android:layout_height="match_parent"
android:layout_weight="20"
android:gravity="center_vertical"
android:orientation="vertical" >
<Button
android:id="#+id/ticket1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/ticket"
android:textAppearance="?android:attr/textAppearanceSmall" />
<Button
android:id="#+id/ticket2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/ticket"
android:textAppearance="?android:attr/textAppearanceSmall" />
<Button
android:id="#+id/ticket3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/ticket"
android:textAppearance="?android:attr/textAppearanceSmall" />
</LinearLayout>
</LinearLayout>
<EditText
android:id="#+id/movieName"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_below="#id/linear1"
android:layout_marginLeft="10dip"
android:layout_marginRight="10dip"
android:layout_weight="1"
android:background="#drawable/input_field"
android:imeOptions="actionDone"
android:inputType="text"
android:padding="10dip" />
<RelativeLayout
android:id="#+id/correctAnswerLayoutContainer"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_below="#id/movieName"
android:layout_marginLeft="10dip"
android:layout_marginRight="10dip"
android:layout_weight="1"
android:background="#drawable/circular_rectangle_white_background"
android:paddingLeft="10dip"
android:visibility="gone" >
<LinearLayout
android:id="#+id/hintContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dip"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal" >
<ImageView
android:layout_width="40dp"
android:layout_height="35dp"
android:src="#drawable/icon" />
<TextView
android:id="#+id/hintOne"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="#string/musical_moview_text"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#android:color/black"
android:textSize="15dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dip"
android:gravity="center_vertical"
android:orientation="horizontal" >
<ImageView
android:layout_width="40dp"
android:layout_height="35dp"
android:src="#drawable/icon" />
<TextView
android:id="#+id/hintTwo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="#string/release_text"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#android:color/black"
android:textSize="15dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dip"
android:layout_marginTop="5dip"
android:gravity="center_vertical"
android:orientation="horizontal" >
<ImageView
android:layout_width="40dp"
android:layout_height="35dp"
android:src="#drawable/icon" />
<TextView
android:id="#+id/hintThree"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="#string/hint3_text"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#android:color/black"
android:textSize="15dp" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
<Button
android:id="#+id/nextButton"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dip"
android:layout_weight="1"
android:background="#drawable/next_btn" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:orientation="vertical"
android:layout_weight="1" >
<com.google.ads.AdView
android:id="#+id/adView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
ads:adSize="BANNER"
ads:adUnitId="#string/publisher_id"
ads:loadAdOnCreate="true" />
</LinearLayout>
</LinearLayout>
Try this..
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:id="#+id/linearmainlayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical"
android:weightSum="10" >
<LinearLayout
android:id="#+id/linear1"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="4"
android:orientation="horizontal"
android:paddingBottom="10dip"
android:paddingTop="5dip"
android:weightSum="100" >
<LinearLayout
android:layout_width="0dip"
android:layout_height="match_parent"
android:layout_weight="20"
android:gravity="center_vertical"
android:orientation="vertical" >
<Button
android:id="#+id/fbShare"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:textAppearance="?android:attr/textAppearanceSmall" />
<Button
android:id="#+id/twitterShare"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:textAppearance="?android:attr/textAppearanceSmall" />
<Button
android:id="#+id/revealButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:textAppearance="?android:attr/textAppearanceSmall" />
</LinearLayout>
<RelativeLayout
android:id="#+id/imageContainer"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal"
android:layout_marginRight="10dip"
android:layout_marginTop="3dp"
android:layout_weight="60"
android:orientation="vertical" >
<RelativeLayout
android:id="#+id/imageView"
android:layout_width="320dip"
android:layout_height="150dip"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true" >
<ImageView
android:id="#+id/correctMark"
android:layout_width="80dip"
android:layout_height="80dip"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_marginBottom="10dip"
android:layout_marginLeft="5dip"
android:src="#drawable/ic_launcher"
android:visibility="gone" />
</RelativeLayout>
</RelativeLayout>
<LinearLayout
android:id="#+id/ticketCounterContainer"
android:layout_width="0dip"
android:layout_height="match_parent"
android:layout_weight="20"
android:gravity="center_vertical"
android:orientation="vertical" >
<Button
android:id="#+id/ticket1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall" />
<Button
android:id="#+id/ticket2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall" />
<Button
android:id="#+id/ticket3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall" />
</LinearLayout>
</LinearLayout>
<EditText
android:id="#+id/movieName"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_below="#+id/linear1"
android:layout_marginLeft="10dip"
android:layout_marginRight="10dip"
android:layout_weight="1"
android:imeOptions="actionDone"
android:inputType="text"
android:padding="10dip" />
<RelativeLayout
android:id="#+id/correctAnswerLayoutContainer"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_below="#+id/movieName"
android:layout_marginLeft="10dip"
android:layout_marginRight="10dip"
android:layout_weight="1"
android:paddingLeft="10dip"
android:visibility="gone" >
<LinearLayout
android:id="#+id/hintContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dip"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal" >
<ImageView
android:layout_width="40dp"
android:layout_height="35dp"
android:src="#drawable/ic_launcher" />
<TextView
android:id="#+id/hintOne"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="musical_moview_text"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#android:color/black"
android:textSize="15dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dip"
android:gravity="center_vertical"
android:orientation="horizontal" >
<ImageView
android:layout_width="40dp"
android:layout_height="35dp"
android:src="#drawable/ic_launcher" />
<TextView
android:id="#+id/hintTwo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="release_text"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#android:color/black"
android:textSize="15dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dip"
android:layout_marginTop="5dip"
android:gravity="center_vertical"
android:orientation="horizontal" >
<ImageView
android:layout_width="40dp"
android:layout_height="35dp"
android:src="#drawable/ic_launcher" />
<TextView
android:id="#+id/hintThree"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="hint3_text"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#android:color/black"
android:textSize="15dp" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
<Button
android:id="#+id/nextButton"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dip"
android:layout_weight="1" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="55dp"
android:orientation="vertical" >
<com.google.ads.AdView
android:id="#+id/adView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
ads:adSize="BANNER"
ads:adUnitId="#string/publisher_id"
ads:loadAdOnCreate="true" />
</LinearLayout>
</LinearLayout>
Put the button and Adview in a new relative layout below the linear layouts.
I have a following code.. I want to scroll my text area and my buttons within in LinearLayout. But my bottom button which is in relativelayout i want to stay it always in bottom not scroll able.
Thanks
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="175dip"
android:background="#android:color/white">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="5dp"
android:textSize="20dip"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="35dp"
android:textSize="15dip"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="55dp"
android:textSize="15dip"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="75dp"
android:textSize="15dip"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="95dp"
android:textSize="15dip"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="115dp"
android:textSize="15dip"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="135dp"
android:textSize="15dip"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="155dp"
android:textSize="15dip"
/>
</RelativeLayout>
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="XYZ"/>
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="XYZ"/>
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="XYZ"/>
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="XYZ"/>
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Contact Us"/>
</LinearLayout>
</ScrollView>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="50dip"
android:background="#android:color/black"
android:layout_alignParentBottom="true" >
<Button
android:id="#+id/buttonCheck"
android:layout_width="50sp"
android:layout_height="50sp"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
android:background="#drawable/round_button"
android:text="Checked" />
</RelativeLayout>
</RelativeLayout>
As you are using relative layout, first put the button at the bottom of screen, and then let scrollview occupy the the height available.
Try following code:
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<RelativeLayout
android:id="#+id/rel_btn_Check"
android:layout_width="fill_parent"
android:layout_height="50dip"
android:layout_alignParentBottom="true"
android:background="#android:color/black" >
<Button
android:id="#+id/buttonCheck"
android:layout_width="50sp"
android:layout_height="50sp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:background="#drawable/round_button"
android:text="Checked" />
</RelativeLayout>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_above="#id/rel_btn_Check"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="175dip"
android:background="#android:color/white" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="5dp"
android:textSize="20dip" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="35dp"
android:textSize="15dip" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="55dp"
android:textSize="15dip" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="75dp"
android:textSize="15dip" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="95dp"
android:textSize="15dip" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="115dp"
android:textSize="15dip" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="135dp"
android:textSize="15dip" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="155dp"
android:textSize="15dip" />
</RelativeLayout>
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="XYZ" />
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="XYZ" />
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="XYZ" />
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="XYZ" />
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Contact Us" />
</LinearLayout>
</ScrollView>
</RelativeLayout>
</RelativeLayout>
use this mechanism
set scroll view >
android:layout_weight="1"
and put footer :
android:layout_alignParentBottom="true"
<LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical">
<ScrollView android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1">
<TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:text="jgfhrtuioghju oioupotyuhjipouipoi typ[ipo[ip[ijup0[ip0[ujiptjuip[juip[i]]]]]]] jogi5thjuohuortthjuo90uto okithjoitthjuo thjpo ktjhporyjohj ptlhjyjohjpy plthjoyjpokjotjhojuyojuhoithjoi kgjhoithoithjuotjupojutpo[ujotpotpojuote]ihihoihoi rguigreuighreiuyghir orighoihyheiyhreiygh oighoihtgihidrfyh8irfyhuesghuyhuiehvguyh rueighuyghuiyghieryhirgeyhi gorfihoihklrjegoij5oi hi thkoihioghoirhirhuiurg] th5yj u trjuykyu yjytku yktyu k ykj k y jiyku ykj yuk yku k y 6ty 6y 6yy kuiil 6 u67 uokityy7 i78o8 "/>
</ScrollView>
<LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true"><Button android:layout_width="match_parent" android:layout_height="wrap_content" android:text="rgfjughtih g5yujhoihuoi"/></LinearLayout></LinearLayout>
here is my xml code in android app. I need horizontal scroll in this layout but using this my gridview's vertical layout is not working properly.When i use this code it scrolls horizontally but it does not allow gridview's vertical scroll to work proper. How can i fix this??? i have changed my code to this now but my horizontal scroll does not work..vertical scroll is fine now in gridview
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="fill_parent" >
<ScrollView
android:scrollbars="horizontal"
android:layout_height="wrap_content"
android:layout_width="wrap_content">
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginTop="22dp" >
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/date"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/date"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
/>
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:text="#string/doc"
android:textAppearance="?android:attr/textAppearanceMedium" />
<Spinner
android:id="#+id/spinner1"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp" />
<Button
android:id="#+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:text="#string/sbmt" />
<Button
android:id="#+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:text="#string/report" />
</LinearLayout>
</ScrollView>
<LinearLayout
android:id="#+id/linearLayout2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="80dp"
>
<TextView
android:id="#+id/textView5"
android:layout_width="120dp"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:text="#string/timeslot" />
<TextView
android:id="#+id/textView6"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:text="#string/appoint" />
<TextView
android:id="#+id/textView7"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:text="#string/waiting" />
<TextView
android:id="#+id/textView8"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:text="#string/protocol" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/linearLayout2"
>
<ListView
android:id="#+id/listView1"
android:layout_width="900dp"
android:layout_height="match_parent"
android:layout_marginTop="10dp" >
</ListView>
</LinearLayout>
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginLeft="96dp"
android:layout_marginTop="14dp"
android:text="#string/welcome"
android:textAppearance="?android:attr/textAppearanceMedium" />
</RelativeLayout>
You can't use listview inside scrollview because Listview so have inbuild scrolling capabilities. Encapsulate it in any other layout like LinearLayout or RelativeLayout
Use like this...
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
>
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginLeft="96dp"
android:layout_marginTop="14dp"
android:text="welcome"
android:textAppearance="?android:attr/textAppearanceMedium" />
<HorizontalScrollView
android:id="#+id/hori_scroll"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginTop="22dp" >
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="date"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/date"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
/>
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:text="doc"
android:textAppearance="?android:attr/textAppearanceMedium" />
<Spinner
android:id="#+id/spinner1"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp" />
<Button
android:id="#+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:text="sbmt" />
<Button
android:id="#+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:text="report" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<TextView
android:id="#+id/textView5"
android:layout_width="120dp"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:text="timeslot" />
<TextView
android:id="#+id/textView6"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:text="appoint" />
<TextView
android:id="#+id/textView7"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:text="waiting" />
<TextView
android:id="#+id/textView8"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:text="protocol" />
</LinearLayout>
</LinearLayout>
</HorizontalScrollView>
<ListView
android:id="#+id/listView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="10dp" >
</ListView>
</LinearLayout>
Use android.support.v4.widget.NestedScrollView and make it root/container layout. Replace ScrollView with RelativeLayout.
Try this:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="fill_parent" >
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="fill_parent" >
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginTop="22dp" >
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/date"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/date"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
/>
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:text="#string/doc"
android:textAppearance="?android:attr/textAppearanceMedium" />
<Spinner
android:id="#+id/spinner1"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp" />
<Button
android:id="#+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:text="#string/sbmt" />
<Button
android:id="#+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:text="#string/report" />
</LinearLayout>
</RelativeLayout>
<LinearLayout
android:id="#+id/linearLayout2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="80dp" >
<TextView
android:id="#+id/textView5"
android:layout_width="120dp"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:text="#string/timeslot" />
<TextView
android:id="#+id/textView6"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:text="#string/appoint" />
<TextView
android:id="#+id/textView7"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:text="#string/waiting" />
<TextView
android:id="#+id/textView8"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:text="#string/protocol" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/linearLayout2">
<ListView
android:id="#+id/listView1"
android:layout_width="900dp"
android:layout_height="match_parent"
android:layout_marginTop="10dp" >
</ListView>
</LinearLayout>
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginLeft="96dp"
android:layout_marginTop="14dp"
android:text="#string/welcome"
android:textAppearance="?android:attr/textAppearanceMedium" />
</RelativeLayout>
</android.support.v4.widget.NestedScrollView>