I have the following layout:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
android:id="#+navigate/RLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ABABAB"
xmlns:android="http://schemas.android.com/apk/res/android"
>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textStyle="bold"
android:id="#+id/myid"
android:layout_centerHorizontal="true"
android:src="#drawable/myid"
android:layout_marginTop="15dp" />.
<RelativeLayout android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="10dp"
android:orientation="vertical"
android:id="#+id/firstRectangle"
android:background="#drawable/bg"
android:layout_below="#+id/myid" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textStyle="bold|italic"
android:textColor="#000000"
android:id="#+id/hotelinfos"
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
android:layout_below="#+id/myid"
android:layout_alignLeft="#+id/myid"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textStyle="bold"
android:textColor="#000000"
android:id="#+id/hotelname"
android:layout_below="#+id/hotelinfos"
android:layout_alignLeft="#+id/hotelinfos"
android:layout_marginTop="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textColor="#000000"
android:id="#+id/hoteladdress"
android:layout_below="#+id/hotelname"
android:layout_alignLeft="#+id/hotelname"
android:layout_marginTop="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:id="#+id/hotelphone"
android:layout_below="#+id/hoteladdress"
android:layout_alignLeft="#+id/hoteladdress"
android:layout_marginTop="10dp"
android:textColor="#12C"
android:textStyle="bold|italic"
android:onClick="onClick"
android:clickable="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textColor="#12C"
android:onClick="onClick"
android:clickable="true"
android:textStyle="bold|italic"
android:id="#+id/hotelemail"
android:layout_below="#+id/hotelphone"
android:layout_alignLeft="#+id/hotelphone"
android:layout_marginTop="10dp"
android:paddingBottom="10dp" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/picture"
android:layout_below="#+id/myid"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="10dp"
android:orientation="vertical"
android:id="#+id/SecondRectangle"
android:background="#drawable/bg"
android:layout_below="#+id/firstRectangle" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textColor="#000000"
android:textStyle="bold|italic"
android:id="#+id/bookinginfos"
android:layout_below="#+id/firstRectangle"
android:layout_alignLeft="#+id/firstRectangle"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textColor="#000000"
android:id="#+id/pnr"
android:layout_below="#+id/bookinginfos"
android:layout_alignLeft="#+id/bookinginfos"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textColor="#000000"
android:id="#+id/segmentCode"
android:layout_below="#+id/pnr"
android:layout_alignLeft="#+id/pnr"
android:layout_marginRight="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textColor="#000000"
android:id="#+id/checkin"
android:layout_below="#+id/segmentCode"
android:layout_alignLeft="#+id/segmentCode"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textColor="#000000"
android:id="#+id/checkout"
android:layout_below="#+id/checkin"
android:layout_alignLeft="#+id/checkin"
android:layout_marginRight="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textColor="#000000"
android:id="#+id/nights"
android:layout_below="#+id/checkout"
android:layout_alignLeft="#+id/checkout"
android:layout_marginRight="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textColor="#000000"
android:id="#+id/roomType"
android:layout_below="#+id/nights"
android:layout_alignLeft="#+id/nights"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textColor="#000000"
android:id="#+id/boardBasis"
android:layout_below="#+id/roomType"
android:layout_alignLeft="#+id/roomType"
android:layout_marginRight="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textColor="#000000"
android:id="#+id/paxNames"
android:layout_below="#+id/boardBasis"
android:layout_alignLeft="#+id/boardBasis"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp"
android:paddingBottom="10dp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="10dp"
android:orientation="vertical"
android:id="#+id/thirdRectangle"
android:background="#drawable/bg"
android:layout_below="#+id/SecondRectangle" >
<ScrollView android:layout_width="fill_parent" android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textColor="#000000"
android:textStyle="bold|italic"
android:id="#+id/forHotel"
android:layout_below="#+id/SecondRectangle"
android:layout_alignLeft="#+id/SecondRectangle"
android:layout_marginLeft="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textColor="#000000"
android:id="#+id/supplierCode"
android:layout_below="#+id/forHotel"
android:layout_alignLeft="#+id/forHotel"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp"
android:paddingBottom="10dp"/>
</ScrollView>
</RelativeLayout>
</RelativeLayout>
I would like to scroll in this layout because the last part of the relativelayout is not visible!
But i don't know how to do it.
I tried to add a scrollview but i got the error: scrollview can host only one direct child!
Do you have any tips for me?
Thanks in advance for your help!
ScrollView expects a single child view and in your layout you have 2 TextView.
To make the ScrollView work you have to wrap your TextView in a ViewGroup like LinearLayout or RelativeLayout.
Edited code:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView android:layout_width="match_parent" android:layout_height="match_parent">
<RelativeLayout
android:id="#+navigate/RLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ABABAB"
xmlns:android="http://schemas.android.com/apk/res/android"
>
// ... THE REST OF YOUR CODE
</RelativeLayout>
</ScrollView>
Take this code right over you want the scroll to start:
<ScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
Then end up with when you want to stop it.
Since scrollview can only have a child, the child can be any layout. Be in LinearLayout or RelativeLayout. So it should be something like this. <ScrollView> <RelativeLayout> </RelativeLayout> </ScrollView>
Your code would end up like this
<RelativeLayout
android:id="#+navigate/RLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ABABAB"
xmlns:android="http://schemas.android.com/apk/res/android"
>
<ScrollView>
android:id="#+navigate/Scrollview"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<RelativeLayout
android:id="#+navigate/RLayout02"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textStyle="bold"
android:id="#+id/hcorpo"
android:layout_centerHorizontal="true"
android:src="#drawable/hcorpo"
android:layout_marginTop="15dp" />.
<RelativeLayout android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="10dp"
android:orientation="vertical"
android:id="#+id/firstRectangle"
android:background="#drawable/bg"
android:layout_below="#+id/hcorpo" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textStyle="bold|italic"
android:textColor="#000000"
android:id="#+id/hotelinfos"
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
android:layout_below="#+id/hcorpo"
android:layout_alignLeft="#+id/hcorpo"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textStyle="bold"
android:textColor="#000000"
android:id="#+id/hotelname"
android:layout_below="#+id/hotelinfos"
android:layout_alignLeft="#+id/hotelinfos"
android:layout_marginTop="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textColor="#000000"
android:id="#+id/hoteladdress"
android:layout_below="#+id/hotelname"
android:layout_alignLeft="#+id/hotelname"
android:layout_marginTop="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:id="#+id/hotelphone"
android:layout_below="#+id/hoteladdress"
android:layout_alignLeft="#+id/hoteladdress"
android:layout_marginTop="10dp"
android:textColor="#12C"
android:textStyle="bold|italic"
android:onClick="onClick"
android:clickable="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textColor="#12C"
android:onClick="onClick"
android:clickable="true"
android:textStyle="bold|italic"
android:id="#+id/hotelemail"
android:layout_below="#+id/hotelphone"
android:layout_alignLeft="#+id/hotelphone"
android:layout_marginTop="10dp"
android:paddingBottom="10dp" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/picture"
android:layout_below="#+id/hcorpo"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="10dp"
android:orientation="vertical"
android:id="#+id/SecondRectangle"
android:background="#drawable/bg"
android:layout_below="#+id/firstRectangle" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textColor="#000000"
android:textStyle="bold|italic"
android:id="#+id/bookinginfos"
android:layout_below="#+id/firstRectangle"
android:layout_alignLeft="#+id/firstRectangle"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textColor="#000000"
android:id="#+id/pnr"
android:layout_below="#+id/bookinginfos"
android:layout_alignLeft="#+id/bookinginfos"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textColor="#000000"
android:id="#+id/segmentCode"
android:layout_below="#+id/pnr"
android:layout_alignLeft="#+id/pnr"
android:layout_marginRight="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textColor="#000000"
android:id="#+id/checkin"
android:layout_below="#+id/segmentCode"
android:layout_alignLeft="#+id/segmentCode"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textColor="#000000"
android:id="#+id/checkout"
android:layout_below="#+id/checkin"
android:layout_alignLeft="#+id/checkin"
android:layout_marginRight="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textColor="#000000"
android:id="#+id/nights"
android:layout_below="#+id/checkout"
android:layout_alignLeft="#+id/checkout"
android:layout_marginRight="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textColor="#000000"
android:id="#+id/roomType"
android:layout_below="#+id/nights"
android:layout_alignLeft="#+id/nights"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textColor="#000000"
android:id="#+id/boardBasis"
android:layout_below="#+id/roomType"
android:layout_alignLeft="#+id/roomType"
android:layout_marginRight="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textColor="#000000"
android:id="#+id/paxNames"
android:layout_below="#+id/boardBasis"
android:layout_alignLeft="#+id/boardBasis"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp"
android:paddingBottom="10dp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="10dp"
android:orientation="vertical"
android:id="#+id/thirdRectangle"
android:background="#drawable/bg"
android:layout_below="#+id/SecondRectangle" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textColor="#000000"
android:textStyle="bold|italic"
android:id="#+id/forHotel"
android:layout_below="#+id/SecondRectangle"
android:layout_alignLeft="#+id/SecondRectangle"
android:layout_marginLeft="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textColor="#000000"
android:id="#+id/supplierCode"
android:layout_below="#+id/forHotel"
android:layout_alignLeft="#+id/forHotel"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp"
android:paddingBottom="10dp"/>
</RelativeLayout>
</RelativeLayout>
</ScrollView>
</RelativeLayout>
Your last RelativeLayout
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="10dp"
android:orientation="vertical"
android:id="#+id/thirdRectangle"
android:background="#drawable/bg"
android:layout_below="#+id/SecondRectangle" >
<ScrollView android:layout_width="fill_parent" android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textColor="#000000"
android:textStyle="bold|italic"
android:id="#+id/forHotel"
android:layout_below="#+id/SecondRectangle"
android:layout_alignLeft="#+id/SecondRectangle"
android:layout_marginLeft="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textColor="#000000"
android:id="#+id/supplierCode"
android:layout_below="#+id/forHotel"
android:layout_alignLeft="#+id/forHotel"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp"
android:paddingBottom="10dp"/>
</ScrollView>
</RelativeLayout>
Should look like this instead:
<ScrollView android:layout_width="fill_parent" android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="10dp"
android:orientation="vertical"
android:id="#+id/thirdRectangle"
android:background="#drawable/bg"
android:layout_below="#+id/SecondRectangle" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textColor="#000000"
android:textStyle="bold|italic"
android:id="#+id/forHotel"
android:layout_below="#+id/SecondRectangle"
android:layout_alignLeft="#+id/SecondRectangle"
android:layout_marginLeft="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:textColor="#000000"
android:id="#+id/supplierCode"
android:layout_below="#+id/forHotel"
android:layout_alignLeft="#+id/forHotel"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp"
android:paddingBottom="10dp"/>
</RelativeLayout>
</ScrollView>
Related
I want last two textview in the bottom of the screen and outside the scrollview...but with my code i can get the linear layout inside the scrollview, If i will define them outside the scrollview..It gives me error:root element must be formated at the last linear layout structure
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#+id/textView2"
android:background="#drawable/back1"
android:scrollbars="horizontal" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="33dp"
android:layout_marginTop="2dp"
android:text=""
android:textColor="#FFFFFF" />
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="33dp"
android:text=""
android:textColor="#FFFFFF" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="33dp"
android:text=""
android:textColor="#FFFFFF" />
<TextView
android:id="#+id/textView5"
android:layout_width="264dp"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginTop="10dp"
android:text=""
android:textColor="#FFFFFF" />
<TableLayout
android:id="#+id/maintable"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginBottom="5dp"
android:layout_marginLeft="20dp" >
</TableLayout>
<TableLayout
android:id="#+id/maintable1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginBottom="5dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="10dp" >
</TableLayout>
<TextView
android:id="#+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#android:id/list"
android:text=""
android:textColor="#FFFFFF" />
<ListView
android:id="#android:id/list"
style=" android:listViewStyle"
android:layout_width="fill_parent"
android:layout_height="70dp"
android:layout_below="#+id/textView6"
android:layout_marginLeft="33dp"
android:drawSelectorOnTop="true"
android:textColor="#FFFFFF" >
</ListView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="0dp"
android:orientation="horizontal"
>
<TextView
android:id="#+id/textView8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="7dp"
android:layout_gravity="bottom"
android:text=""
android:layout_marginBottom="5dp"
android:textColor="#FFFFFF"
android:textColorLink="#FFFFFF" />
<TextView
android:id="#+id/textView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="12dp"
android:layout_marginTop="1dp"
android:layout_marginBottom="5dp"
android:text=""
android:layout_gravity="bottom"
android:textColor="#FFFFFF"
android:textColorLink="#FFFFFF" />
</LinearLayout>
</LinearLayout>
</ScrollView>
Try this, add/change the design yourself :)
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/darkblue">
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/scrollView"
android:scrollbars="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="33dp"
android:layout_marginTop="2dp"
android:text="Hello"
android:textColor="#FFFFFF" />
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="33dp"
android:text="Hello"
android:textColor="#FFFFFF" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="33dp"
android:text="Hello"
android:textColor="#FFFFFF" />
<TextView
android:id="#+id/textView5"
android:layout_width="264dp"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginTop="10dp"
android:text="Hello"
android:textColor="#FFFFFF" />
<TableLayout
android:id="#+id/maintable"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginLeft="20dp" >
</TableLayout>
<TableLayout
android:id="#+id/maintable1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="10dp" >
</TableLayout>
<TextView
android:id="#+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#android:id/list"
android:text="Hello"
android:textColor="#FFFFFF" />
<ListView
android:id="#android:id/list"
style=" android:listViewStyle"
android:layout_width="match_parent"
android:layout_height="70dp"
android:layout_below="#+id/textView6"
android:layout_marginLeft="33dp"
android:drawSelectorOnTop="true"
android:textColor="#FFFFFF" >
</ListView>
</LinearLayout>
</ScrollView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/scrollView"
android:orientation="horizontal">
<TextView
android:id="#+id/textView8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="7dp"
android:layout_gravity="bottom"
android:text="Hello"
android:layout_marginBottom="5dp"
android:textColor="#FFFFFF"
android:textColorLink="#FFFFFF" />
<TextView
android:id="#+id/textView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="12dp"
android:layout_marginTop="1dp"
android:layout_marginBottom="5dp"
android:text="Hello"
android:layout_gravity="bottom"
android:textColor="#FFFFFF"
android:textColorLink="#FFFFFF" />
</LinearLayout>
</RelativeLayout>
i have a ScrollView in android, inside it i have a RelativeLayout, my problem its the scroll doesnt go to the end and i cant see the last TextView.
This is the XML
<!-- Main layout -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".TabOrderActivity$OrderDetailFragment"
android:orientation="vertical"
android:background="#drawable/fondodroid2"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingBottom="#dimen/activity_vertical_margin"
android:weightSum="1">
<LinearLayout
android:id="#+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/blue_gg"
android:paddingTop="5dip">
<TextView
android:text="#string/orderDetail"
android:textSize="32sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dip"
android:textColor="#android:color/white" />
</LinearLayout>
<LinearLayout
android:id="#+id/header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="5dip"
android:paddingBottom="5dip"
android:orientation="horizontal">
<TextView
android:text="NÂș"
android:textSize="28sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:textStyle="bold"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp" />
<TextView
android:id="#+id/file"
android:textSize="28sp"
android:layout_marginLeft="20dp"
style="#style/orderHeader"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_marginTop="10dp"
android:layout_weight="2.16"
android:layout_marginRight="0dp"
android:text="numero de orden" />
</LinearLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:id="#+id/scrollView">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp">
<TextView
android:id="#+id/policyHolderLabel"
style="#style/orderHeader"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/customer"
android:textAppearance="?android:attr/textAppearanceLarge"
android:gravity="left|top"
android:textSize="24dp"
android:layout_alignParentLeft="true"
android:layout_marginTop="0dp"
android:textStyle="bold" />
<TextView
android:id="#+id/policyHolder"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_toRightOf="#+id/policyHolderLabel"
android:gravity="left|top"
android:layout_marginLeft="10dp"
android:textSize="20sp" />
<TextView
android:id="#+id/cityLabel"
style="#style/orderHeader"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/city"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_below="#+id/policyHolder"
android:layout_alignParentLeft="true"
android:layout_marginTop="10dp"
android:gravity="left|top"
android:textSize="24dp"
android:textStyle="bold" />
<TextView
android:id="#+id/city"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_toRightOf="#+id/cityLabel"
android:gravity="left|top"
android:layout_marginLeft="10dp"
android:textSize="20sp"
android:layout_alignBottom="#+id/cityLabel" />
<TextView
android:id="#+id/provinceLabel"
style="#style/orderHeader"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/province"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_below="#+id/city"
android:layout_alignParentLeft="true"
android:layout_marginTop="10dp"
android:gravity="left|top"
android:textSize="24dp"
android:textStyle="bold" />
<TextView
android:id="#+id/province"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:gravity="left|top"
android:layout_toRightOf="#+id/provinceLabel"
android:layout_marginLeft="10dp"
android:textSize="20sp"
android:layout_alignBottom="#+id/provinceLabel" />
<TextView
android:id="#+id/addressLabel"
style="#style/orderHeader"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/address"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_marginTop="10dp"
android:gravity="left|top"
android:textSize="24dp"
android:layout_below="#+id/province"
android:layout_alignParentLeft="true"
android:textStyle="bold" />
<TextView
android:id="#+id/address"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:gravity="left|top"
android:layout_toRightOf="#+id/addressLabel"
android:layout_marginLeft="10dp"
android:textSize="20sp"
android:layout_alignBottom="#+id/addressLabel" />
<TextView
android:id="#+id/zipCode"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:gravity="left|top"
android:layout_toRightOf="#+id/addressLabel"
android:layout_below="#+id/address"
android:layout_marginLeft="10dp" />
<TextView
android:id="#+id/phonesLabel"
style="#style/orderHeader"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/phones"
android:textAppearance="?android:attr/textAppearanceLarge"
android:gravity="left|top"
android:layout_below="#+id/zipCode"
android:layout_alignParentLeft="true"
android:layout_marginTop="10dp"
android:textSize="24dp"
android:textStyle="bold" />
<TextView
android:id="#+id/phone1"
android:inputType="phone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left|top"
android:textSize="20sp"
android:layout_toRightOf="#+id/phonesLabel"
android:layout_marginLeft="10dp"
android:layout_alignBottom="#+id/phonesLabel" />
<TextView
android:id="#+id/descriptionLabel"
style="#style/orderHeader"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/description"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_below="#+id/phonesLabel"
android:layout_alignParentLeft="true"
android:layout_marginTop="10dp"
android:gravity="left|top"
android:textSize="24dp"
android:textStyle="bold" />
<TextView
android:id="#+id/description"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/descriptionLabel"
android:layout_below="#+id/descriptionLabel"
android:layout_marginTop="10dp"
android:editable="false"
android:inputType="textMultiLine"
android:textAppearance="?android:attr/textAppearanceLarge"
android:gravity="left|top"
android:textSize="20sp"
android:layout_marginBottom="10dp" />
<TextView
android:id="#+id/coverageLabel"
style="#style/orderHeader"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/Cobertura"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_below="#+id/description"
android:layout_alignParentLeft="true"
android:layout_marginTop="10dp"
android:gravity="left|top"
android:textSize="24dp"
android:textStyle="bold" />
<TextView
android:id="#+id/coverage"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/coverageLabel"
android:layout_below="#+id/coverageLabel"
android:layout_marginTop="10dp"
android:editable="false"
android:inputType="textMultiLine"
android:textAppearance="?android:attr/textAppearanceLarge"
android:gravity="left|top"
android:textSize="20sp"
android:layout_marginBottom="10dp" />
</RelativeLayout>
</ScrollView>
</LinearLayout>
I tried to set a LinearLayout inside scrollview and the linearlayout contains the relative but i got the same result.
Whats wrong?
Try to change the margins to paddings:
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="20dp"
android:paddingLeft="10dp"
android:paddingRight="10dp">
Hope this helps.
I have a problem, I have a long layout so I need it will be scrollable. But I need two listview in it. I have made using linearlayout and in forcycle I add a items in it. But I have lost all functions what listview offers and I want to use them.
Do anybody knows, how looks like "events" view in facebook app? It looks like there are a lot of listviews (birthdays, events, ...) and whole view is scrollable. I need something like this.
Thank you for ansver. :)
EDIT: There is my xml (There are two LinearLayouts: #+id/passengersList and #+id/discussionList and I want use ListViews instead):
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/travelDetailScroll"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#f8ffe1"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:paddingRight="5dp"
android:paddingLeft="5dp">
<TextView
android:id="#+id/travelId"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone" />
<RelativeLayout
android:id="#+id/header"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/waypoints"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="5dp"
android:textColor="#333333"
android:textSize="16sp" />
<ImageView
android:id="#+id/travelMap"
android:layout_width="70dp"
android:layout_height="70dp"
android:paddingLeft="0dp"
android:paddingTop="0dp"
android:paddingRight="8dp"
android:layout_below="#+id/waypoints"
android:contentDescription="#string/travel_detail" />
<TextView
android:id="#+id/driver"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/waypoints"
android:layout_toRightOf="#+id/travelMap"
android:textColor="#333333"
android:textSize="14sp" />
<TextView
android:id="#+id/car"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/driver"
android:layout_toRightOf="#+id/travelMap"
android:paddingBottom="10dp"
android:textColor="#333333"
android:textSize="14sp" />
<TextView
android:id="#+id/date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/waypoints"
android:textColor="#aaaaaa"
android:layout_alignParentRight="true"
android:textSize="14sp" />
<TextView
android:id="#+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/date"
android:layout_alignParentRight="true"
android:textColor="#aaaaaa"
android:textSize="14sp" />
<ImageView
android:id="#+id/icon_price"
android:layout_below="#+id/car"
android:layout_toRightOf="#+id/travelMap"
android:layout_width="20dp"
android:layout_height="20dp"
android:paddingLeft="0dp"
android:paddingTop="0dp"
android:paddingRight="6dp"
android:contentDescription="#string/travel_price" />
<TextView
android:id="#+id/price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/car"
android:layout_toRightOf="#+id/icon_price"
android:paddingRight="40dp"
android:textColor="#333333"
android:textSize="14sp" />
<ImageView
android:id="#+id/icon_seats"
android:layout_below="#+id/car"
android:layout_toRightOf="#+id/price"
android:layout_gravity="center|center_vertical"
android:layout_width="20dp"
android:layout_height="20dp"
android:paddingLeft="0dp"
android:paddingTop="0dp"
android:paddingRight="6dp"
android:contentDescription="#string/travel_seats" />
<TextView
android:id="#+id/seats"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/car"
android:layout_toRightOf="#+id/icon_seats"
android:layout_gravity="center|center_vertical"
android:paddingBottom="10dp"
android:textColor="#333333"
android:textSize="14sp" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/buttons"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/header"
android:layout_centerHorizontal="true" >
<RelativeLayout
android:id="#+id/buttonsLeft"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<Button
android:id="#+id/btn_travel_login"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/travel_login" />
<Button
android:id="#+id/btn_travel_logout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/travel_logout"
android:visibility="gone" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/buttonsRight"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingRight="8dp"
android:layout_toRightOf="#+id/buttonsLeft" >
<Button
android:id="#+id/btn_travel_edit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/travel_edit"
android:visibility="gone" />
<Button
android:id="#+id/btn_travel_watch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/travel_watch"
android:visibility="gone" />
<Button
android:id="#+id/btn_travel_unwatch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/travel_unwatch"
android:visibility="gone" />
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="#+id/buttons"
android:paddingTop="10dp">
<TextView
android:id="#+id/driverTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center|center_vertical"
android:paddingBottom="2dp"
android:textColor="#333333"
android:textSize="14sp"
android:text="#string/driver_title" />
<RelativeLayout
android:id="#+id/driverInfo"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/driverTitle"
android:background="#f8ffe1">
<ImageView
android:id="#+id/driverPhoto"
android:layout_width="65dp"
android:layout_height="65dp"
android:paddingRight="8dp"
android:paddingLeft="0dp"
android:paddingTop="0dp" />
<TextView
android:id="#+id/driverName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="5dp"
android:layout_toRightOf="#+id/driverPhoto"
android:textColor="#333333"
android:textSize="16sp" />
<TextView
android:id="#+id/driverEmail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/driverName"
android:layout_toRightOf="#+id/driverPhoto"
android:textColor="#999999"
android:textSize="14sp" />
<TextView
android:id="#+id/driverPhone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/driverEmail"
android:layout_toRightOf="#+id/driverPhoto"
android:paddingBottom="10dp"
android:textColor="#333333"
android:textSize="14sp" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/passengersInfo"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/driverInfo"
android:paddingTop="10dp">
<TextView
android:id="#+id/passengersTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center|center_vertical"
android:paddingTop="7dp"
android:paddingBottom="2dp"
android:textColor="#333333"
android:textSize="14sp"
android:text="#string/passengers_title" />
<TextView
android:id="#+id/noPassengers"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_below="#+id/passengersTitle"
android:textColor="#333333"
android:textSize="14sp"
android:text="#string/no_passengers"
android:visibility="gone" />
<LinearLayout
android:id="#+id/passengersList"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_below="#+id/passengersTitle"
android:orientation="vertical" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/discussion"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/passengersInfo"
android:paddingTop="10dp">
<TextView
android:id="#+id/discussionTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="2dp"
android:textColor="#333333"
android:textSize="14sp"
android:text="#string/discussion_title" />
<LinearLayout
android:id="#+id/discussionList"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_below="#+id/discussionTitle"
android:orientation="vertical" />
<TextView
android:id="#+id/addMessageLink"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="7dp"
android:paddingBottom="2dp"
android:textColor="#8ec83e"
android:textSize="14sp"
android:layout_below="#+id/discussionList"
android:layout_centerHorizontal="true"
android:text="#string/add_message" />
<LinearLayout android:id="#+id/newMessageLayout"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:layout_below="#+id/addMessageLink"
android:orientation="horizontal"
android:paddingTop="7dp"
android:paddingBottom="2dp"
android:visibility="gone">
<EditText
android:id="#+id/newMessage"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textColor="#333333"
android:textSize="14sp"
android:hint="#string/new_message"
android:layout_weight="3" />
<Button
android:id="#+id/addMessage"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textColor="#333333"
android:textSize="14sp"
android:hint="#string/send_message"
android:layout_gravity="right"
android:layout_weight="1" />
</LinearLayout>
</RelativeLayout>
<RelativeLayout
android:id="#+id/waypointsDetail"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/discussion"
android:paddingTop="10dp">
<TextView
android:id="#+id/waypointsTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="2dp"
android:textColor="#333333"
android:textSize="14sp"
android:text="#string/waypoints_title" />
<LinearLayout android:id="#+id/waypointsList"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:layout_below="#+id/waypointsTitle"
android:orientation="vertical" />
<TextView
android:id="#+id/waypointsSummary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="10dp"
android:paddingBottom="2dp"
android:textColor="#333333"
android:textSize="14sp"
android:layout_below="#+id/waypointsList" />
</RelativeLayout>
</RelativeLayout>
</RelativeLayout>
</ScrollView>
I have made a simple form in android and have put all the form contents in that scrollView but my scrollView doesnt working ,It not scrolls down,My code is as below:
main.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<View
android:id="#+id/line"
android:layout_width="fill_parent"
android:layout_height="7dp"
android:layout_alignParentTop="true"
android:background="#4fc1e9" />
<TextView
android:id="#+id/title_reg"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/line"
android:gravity="center"
android:padding="13dp"
android:text="#string/title_registration"
android:textColor="#cecece"
android:textSize="16dp"
android:textStyle="bold" />
<RelativeLayout
android:id="#+id/btn_qq_login"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/title_reg" >
<TextView
android:id="#+id/tv_qq_login"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="#5d9cec"
android:gravity="center"
android:padding="12dp"
android:text="#string/qq_login"
android:textColor="#ffffff"
android:textSize="18dp"
android:textStyle="bold" />
</RelativeLayout>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="#+id/btn_qq_login"
android:fillViewport="true" >
<RelativeLayout
android:id="#+id/rl_1"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/txt_or"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:gravity="center"
android:text="#string/or"
android:textColor="#cecece"
android:textSize="16dp"
android:textStyle="bold" />
<TextView
android:id="#+id/txt_reg_new_account"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/txt_or"
android:autoLink="web"
android:gravity="center"
android:text="#string/reg_new_account"
android:textColor="#cecece"
android:textColorLink="#cecece"
android:textSize="16dp"
android:textStyle="bold" />
<TextView
android:id="#+id/txt_ur_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/txt_reg_new_account"
android:layout_marginLeft="20dp"
android:layout_marginTop="5dp"
android:text="#string/reg_name"
android:textColor="#cecece"
android:textSize="14dp" />
<EditText
android:id="#+id/et_txt_ur_name"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/txt_ur_name"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="5dp"
android:background="#drawable/bg_editext"
android:hint="#string/hint_reg_name"
android:padding="8dp"
android:textColorHint="#cecece"
android:textSize="14dp" />
<TextView
android:id="#+id/txt_ur_email"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/et_txt_ur_name"
android:layout_marginLeft="20dp"
android:layout_marginTop="5dp"
android:text="#string/reg_email"
android:textColor="#cecece"
android:textSize="14dp" />
<EditText
android:id="#+id/et_txt_ur_email"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/txt_ur_email"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="5dp"
android:background="#drawable/bg_editext"
android:hint="#string/hint_reg_email"
android:padding="8dp"
android:textColorHint="#cecece"
android:textSize="14dp" />
<TextView
android:id="#+id/txt_ur_phone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/et_txt_ur_email"
android:layout_marginLeft="20dp"
android:layout_marginTop="5dp"
android:text="#string/reg_phone_number"
android:textColor="#cecece"
android:textSize="14dp" />
<EditText
android:id="#+id/et_txt_ur_phone"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/txt_ur_phone"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="5dp"
android:background="#drawable/bg_editext"
android:hint="#string/hint_reg_phone_number"
android:padding="8dp"
android:textColorHint="#cecece"
android:textSize="14dp" />
<TextView
android:id="#+id/txt_ur_password"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/et_txt_ur_phone"
android:layout_marginLeft="20dp"
android:layout_marginTop="5dp"
android:text="#string/reg_pwd"
android:textColor="#cecece"
android:textSize="14dp" />
<EditText
android:id="#+id/et_txt_ur_password"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/txt_ur_password"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="15dp"
android:background="#drawable/bg_editext"
android:hint="#string/hint_reg_pwd"
android:padding="8dp"
android:textColorHint="#cecece"
android:textSize="14dp" />
</RelativeLayout>
</ScrollView>
<RelativeLayout
android:id="#+id/reg_bottom"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="#f5f7f9"
android:paddingBottom="5dp" >
<Button
android:id="#+id/btn_register"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="15dp"
android:background="#drawable/btn_register"
android:gravity="center"
android:text="#string/btn_reg"
android:textColor="#ffffff" />
<TextView
android:id="#+id/txt_already_member"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/btn_register"
android:layout_centerHorizontal="true"
android:layout_marginTop="5dp"
android:text="#string/txt_already_member"
android:textColor="#babfc3"
android:textSize="12dp" />
<TextView
android:id="#+id/txt_already_login"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/btn_register"
android:layout_centerHorizontal="true"
android:layout_marginLeft="3dp"
android:layout_marginTop="5dp"
android:layout_toRightOf="#+id/txt_already_member"
android:autoLink="web"
android:text="#string/txt_already_login"
android:textColor="#3a91ea"
android:textColorLink="#cecece"
android:textSize="12dp" />
</RelativeLayout>
<ImageView
android:id="#+id/iv_logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="15dp"
android:layout_marginTop="47dp"
android:background="#drawable/qq" />
</RelativeLayout>
Please help me sort it out..Thank you
you have problem with ScrollView.you need to specify to the scroll view for scrolling.
just add below property in to ScrollView
android:layout_above="#+id/reg_bottom"
you need to bind your scroll view.
thanx.
I am using an activity with style of android:theme="#android:style/Theme.Dialog" .The activity is shown as dialog but the problem is to reduce the height of the dialog to specified level..
Please give me a solution??????
This is my activity dialog XML code
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/bg"
android:orientation="vertical"
style="#style/MyActionsDialogTheme">
<RelativeLayout
android:id="#+id/relativeLayout1"
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="#drawable/custom_title"
android:gravity="center_vertical" >
<RelativeLayout
android:id="#+id/relativeLayout2"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginBottom="5dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="5dp"
android:gravity="center_vertical" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:gravity="center_vertical"
android:text="Quick Actions"
android:textColor="#ffffff"
android:textSize="18dp"
android:textStyle="bold|italic"
android:typeface="serif" />
</RelativeLayout>
</RelativeLayout>
<TextView
android:id="#+id/tv_edit"
android:layout_gravity="center_horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="20dp"
android:text="Edit Reminder"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#000000"
android:textStyle="bold|italic"
android:typeface="serif" />
<TextView
android:id="#+id/tv_delete"
android:layout_gravity="center_horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:text="Delete Reminder"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#000000"
android:textStyle="bold|italic"
android:typeface="serif" />
<Button
android:id="#+id/btn_cancel"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#drawable/custom_button"
android:text="Cancel"
android:textColor="#ffffff"
android:textStyle="bold|italic"
android:typeface="serif" />
</LinearLayout>
Try this.. give dialog main layout hight as wrap_content
if you give match_parent means it'll fill the parent layout full so give wrap_content
<RelativeLayout
android:id="#+id/relativeLayout1"
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="#drawable/custom_title"
android:gravity="center_vertical" >
<RelativeLayout
android:id="#+id/relativeLayout2"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginBottom="5dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="5dp"
android:gravity="center_vertical" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:gravity="center_vertical"
android:text="Quick Actions"
android:textColor="#ffffff"
android:textSize="18dp"
android:textStyle="bold|italic"
android:typeface="serif" />
</RelativeLayout>
</RelativeLayout>
<TextView
android:id="#+id/tv_edit"
android:layout_gravity="center_horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="20dp"
android:text="Edit Reminder"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#000000"
android:textStyle="bold|italic"
android:typeface="serif" />
<TextView
android:id="#+id/tv_delete"
android:layout_gravity="center_horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:text="Delete Reminder"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#000000"
android:textStyle="bold|italic"
android:typeface="serif" />
<Button
android:id="#+id/btn_cancel"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#drawable/custom_button"
android:text="Cancel"
android:textColor="#ffffff"
android:textStyle="bold|italic"
android:typeface="serif" />
try this
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/bg"
android:orientation="vertical"
style="#style/MyActionsDialogTheme">
<RelativeLayout
android:id="#+id/relativeLayout1"
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="#drawable/custom_title"
android:gravity="center_vertical" >
<RelativeLayout
android:id="#+id/relativeLayout2"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginBottom="5dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="5dp"
android:gravity="center_vertical" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:gravity="center_vertical"
android:text="Quick Actions"
android:textColor="#ffffff"
android:textSize="18dp"
android:textStyle="bold|italic"
android:typeface="serif" />
</RelativeLayout>
</RelativeLayout>
<TextView
android:id="#+id/tv_edit"
android:layout_gravity="center_horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="20dp"
android:text="Edit Reminder"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#000000"
android:textStyle="bold|italic"
android:typeface="serif" />
<TextView
android:id="#+id/tv_delete"
android:layout_gravity="center_horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:text="Delete Reminder"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#000000"
android:textStyle="bold|italic"
android:typeface="serif" />
<Button
android:id="#+id/btn_cancel"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#drawable/custom_button"
android:text="Cancel"
android:textColor="#ffffff"
android:textStyle="bold|italic"
android:typeface="serif" />
</LinearLayout>
use wrap Content in place of matchparent in LinearLayout
Just reduce the background image , then it's work