How to reduce the activity dialog height in android - android

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

Related

Making Android Layout Scrollable

I am developing an Android App inside Visual Studio and I cant figure out how to make it scroll.
I am posting my AXML pastebin link!
AXML file
Thank you
Put your xml stuff inside a ScrollView. You should also change the android:layout_height of your root LinearLayout to wrap_content.
<?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:background="#f0ffa0"
android:scrollIndicators="right"
android:scrollbarStyle="insideOverlay"
android:scrollbars="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="match_parent"
android:layout_height="65.3dp"
android:background="#aecc0a"
android:orientation="horizontal">
<ImageButton
android:id="#+id/imageButton1"
android:layout_width="48.3dp"
android:layout_height="41.0dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="15dp"
android:adjustViewBounds="true"
android:background="#aecc0a"
android:clickable="true"
android:hapticFeedbackEnabled="true"
android:scaleType="fitStart"
android:src="#drawable/backbutton"/>
<TextView
android:id="#+id/loginLabel1"
android:layout_width="62.0dp"
android:layout_height="24.0dp"
android:layout_marginLeft="98dp"
android:layout_marginTop="25dp"
android:text="LOGIN"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#000000"
android:textSize="20dp"
android:textStyle="bold"/>
<ImageView
android:id="#+id/imageView1"
android:layout_width="54.7dp"
android:layout_height="42.7dp"
android:layout_marginLeft="80dp"
android:layout_marginRight="10dp"
android:layout_marginTop="15dp"
android:src="#drawable/loginicon2"/>
</LinearLayout>
<Button
android:id="#+id/button1"
android:layout_width="match_parent"
android:layout_height="3.0dp"
android:layout_marginBottom="0dp"
android:background="#414347"
android:clickable="false"
android:text="Button"/>
<TextView
android:id="#+id/loginlabel3"
android:layout_width="258.3dp"
android:layout_height="wrap_content"
android:layout_marginLeft="60dp"
android:layout_marginTop="20dp"
android:text="ENTER YOUR DETAILS"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#000000"
android:textSize="25dp"
android:textStyle="bold"/>
<Button
android:id="#+id/button1"
android:layout_width="310dp"
android:layout_height="3.0dp"
android:layout_marginBottom="0dp"
android:layout_marginLeft="25dp"
android:layout_marginTop="10dp"
android:background="#414347"
android:clickable="false"
android:text="Button"/>
<TextView
android:id="#+id/loginLabel1"
android:layout_width="148.3dp"
android:layout_height="wrap_content"
android:layout_marginLeft="120dp"
android:layout_marginTop="50dp"
android:text="CUSTOMER ID"
android:textAlignment="center"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#000000"
android:textSize="20dp"
android:textStyle="bold"
android:typeface="serif"/>
<EditText
android:id="#+id/loginCustID"
android:layout_width="144.0dp"
android:layout_height="37.0dp"
android:layout_marginLeft="120dp"
android:layout_marginTop="5dp"
android:background="#ffffff"
android:editable="true"
android:hint="*Required"
android:inputType="numberSigned"
android:maxLength="8"
android:text="1234565432456"
android:textAlignment="center"
android:textColor="#000000"
android:textSize="30dp"
android:textStyle="bold"/>
<TextView
android:id="#+id/loginLabel4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="135dp"
android:layout_marginTop="30dp"
android:text="PASSWORD"
android:textAlignment="center"
android:textAllCaps="false"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#000000"
android:textIsSelectable="false"
android:textSize="20dp"
android:textStyle="bold"/>
<EditText
android:id="#+id/loginPassword"
android:layout_width="200.0dp"
android:layout_height="37.0dp"
android:layout_marginLeft="95dp"
android:layout_marginTop="7dp"
android:background="#ffffff"
android:inputType="text"
android:password="true"
android:text="1234567890"
android:textColor="#000000"
android:textIsSelectable="false"
android:textSize="30dp"
android:textStyle="bold"/>
<Button
android:id="#+id/loginSubmit"
android:layout_width="140.5dp"
android:layout_height="66.0dp"
android:layout_marginLeft="120dp"
android:layout_marginTop="60dp"
android:background="#5dea4b"
android:scrollbarStyle="insideInset"
android:scrollbars="vertical"
android:text="LOGIN"
android:textAlignment="center"
android:textSize="25dp"
android:textStyle="bold"/>
<Button
android:id="#+id/button1"
android:layout_width="match_parent"
android:layout_height="3.0dp"
android:layout_marginBottom="0dp"
android:layout_marginTop="50dp"
android:background="#414347"
android:clickable="false"
android:text="Button"/>
<LinearLayout
android:id="#+id/linearLayout2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:id="#+id/linearLayout3"
android:layout_width="260.0dp"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="#+id/textView1"
android:layout_width="230.3dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginTop="5dp"
android:scrollbarStyle="insideOverlay"
android:text="* Customer ID is 8 digits long"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000000"
android:textStyle="italic"/>
<TextView
android:id="#+id/textView2"
android:layout_width="235.0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginTop="5dp"
android:text="* Password is 8-10 digits long"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000000"
android:textStyle="italic"/>
</LinearLayout>
<Button
android:id="#+id/button1"
android:layout_width="2.7dp"
android:layout_height="92.7dp"
android:background="#414347"
android:clickable="false"/>
<ImageButton
android:id="#+id/imageButton2"
android:layout_width="89.0dp"
android:layout_height="78.0dp"
android:layout_marginLeft="5dp"
android:layout_marginTop="5dp"
android:background="#f0ffa0"
android:scaleType="fitCenter"
android:src="#drawable/easeofaccess"/>
</LinearLayout>
</LinearLayout>
</ScrollView>

Putting TextViews in relative layout

I am trying to add three text views as follows, but I could not able to achieve it. I want A to be on the left side, and the other two texviews to be right side.
Here is what I get:
Here is my current implementation
<RelativeLayout
android:id="#+id/mainlayout"
android:layout_width="match_parent"
android:layout_height="40dp"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:background="#363636">
<TextView
android:layout_alignParentLeft="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="A"
android:textColor="#android:color/white"
android:paddingTop="3dp"
android:paddingBottom="3dp"
android:textSize="16sp"
android:fontFamily="sans-serif-medium" />
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_alignParentRight="true"
android:id="#+id/innerLayout">
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_centerVertical="true"
android:text="B "
android:textSize="16sp"
android:textColor="#android:color/white"
android:paddingRight="8dp" />
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_centerVertical="true"
android:text="C "
android:textSize="16sp"
android:textColor="#android:color/white"
android:paddingTop="3dp"
android:paddingBottom="3dp"
android:paddingLeft="8dp"
android:paddingRight="8dp" />
</RelativeLayout>
</RelativeLayout>
use this:
<RelativeLayout 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"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:id="#+id/A"
android:text="aaaaaaa"
android:padding="8dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:id="#+id/C"
android:text="ccccccc"
android:padding="8dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="#id/C"
android:id="#+id/B"
android:text="bbbbbbb"
android:padding="8dp"/>
</RelativeLayout>
Change the xml like this ,
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/mainlayout"
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="#363636"
android:paddingLeft="20dp"
android:paddingRight="20dp">
<TextView android:background="#458765"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:fontFamily="sans-serif-medium"
android:paddingBottom="3dp"
android:paddingTop="3dp"
android:text="A"
android:textColor="#android:color/white"
android:textSize="16sp" />
<RelativeLayout
android:id="#+id/innerLayout"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_alignParentRight="true">
<TextView android:background="#458765"
android:id="#+id/b"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:text="B"
android:textColor="#android:color/white"
android:textSize="16sp" />
<TextView android:layout_marginLeft="5dp" android:background="#458765"
android:layout_toRightOf="#id/b"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:text="C"
android:textColor="#android:color/white"
android:textSize="16sp" />
</RelativeLayout>
</RelativeLayout>

Relative layout is shifing when progress bar running

I have login layout,when progress bar executes the layout shifts, This my xml code please check my code.And help me to rseolve.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:flatui="http://schemas.android.com/apk/res-auto"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:wheel="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Mobile Number"
android:layout_marginTop="60dp"
android:layout_marginLeft="20dp"
android:textSize="15dp"
android:layout_marginBottom="40dp"
android:textStyle="bold" />
<EditText
android:id="#+id/mnum"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#drawable/edit_text_design"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="90dp"
android:layout_marginBottom="40dp"
style="#style/EditBoxStyle"
android:inputType="phone"
android:maxLength="10"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Password"
android:layout_marginTop="150dp"
android:layout_marginLeft="20dp"
android:textSize="15dp"
android:layout_marginBottom="40dp"
android:textStyle="bold" />
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#drawable/edit_text_design"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="175dp"
android:layout_marginBottom="40dp"
style="#style/EditBoxStyle"
android:inputType="textPassword"
android:id="#+id/pswrd" />
<com.cengalabs.flatui.views.FlatButton
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Login"
android:id="#+id/loginBtn"
android:layout_gravity="center_horizontal"
android:layout_marginTop="235dp"
flatui:fl_touchEffect="fl_ripple"
flatui:fl_theme="#array/grass"
flatui:fl_blockButtonEffectHeight="3dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="40dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/frgtext"
android:layout_gravity="center_horizontal"
android:text="Forgot Password?"
android:autoText="false"
android:clickable="true"
android:layout_alignParentBottom="false"
android:layout_centerHorizontal="true"
android:layout_marginTop="300dp"
android:textColor="#ff666666"
android:textSize="20dp"
android:textStyle="bold" />
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<!-- <ProgressBar
android:id="#+id/loading"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/loginBtn"
android:layout_centerHorizontal="true"
/>-->
<com.pnikosis.materialishprogress.ProgressWheel
android:id="#+id/loading"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
wheel:matProg_barColor="#ff5cb85c"
wheel:matProg_progressIndeterminate="true" />
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity = "bottom"
android:layout_alignParentBottom="true"
>
<TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TableRow>
<Button
android:layout_marginLeft="-5dp"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_weight="1"
android:id="#+id/ntregtext"
android:text="New Registration"
android:textColor="#ff666666"
android:layout_marginRight="0dp"
android:textAllCaps="false"
android:textStyle="bold" />
<Button
android:layout_marginLeft="-8dp"
android:layout_marginRight="-5dp"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginTop="2dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:text="Check our offers"
android:textColor="#ff666666"
android:textAllCaps="false"
android:textStyle="bold" />
</TableRow>
</TableLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:layout_marginTop="50dp"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:layout_marginBottom="5dp"
android:textAlignment="gravity"
android:textAllCaps="false"
android:textStyle="bold"
android:gravity="center_horizontal"
android:layout_centerHorizontal="true" />
</RelativeLayout>
</LinearLayout>
Attached Images before progress bar and after progress bar running................................................
Instead of Table layout used Liner layout given weightsum as total item in horizontal.
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity = "bottom"
android:layout_alignParentBottom="true"
>
<!-- <TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TableRow>-->
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="2">
<Button
android:layout_marginLeft="-5dp"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_weight="1"
android:id="#+id/ntregtext"
android:text="New Registration"
android:textColor="#ff666666"
android:layout_marginRight="0dp"
android:textAllCaps="false"
android:textStyle="bold" />
<Button
android:layout_marginLeft="-8dp"
android:layout_marginRight="-5dp"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginTop="2dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:text="Check our offers"
android:textColor="#ff666666"
android:textAllCaps="false"
android:textStyle="bold" />
<!-- </TableRow>
</TableLayout>-->
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="sad"
android:layout_marginTop="50dp"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:layout_marginBottom="5dp"
android:textAlignment="gravity"
android:textAllCaps="false"
android:textStyle="bold"
android:gravity="center_horizontal"
android:layout_centerHorizontal="true" />
</RelativeLayout>

customized list view with text view and button not support for multiple screen?

In my app am using customized listed view with text view and Buttons.The screen size is 4.65" 720p(720X1280 : xhdpi),device take this resolution from layout-large folder.when i run it on device.the list view item and header display not fit to the screen like image shown below,some empty space in the end of row.Its not able to fit to the screen.Can any one know please help me to solve this issue.
Header XML Coding
<RelativeLayout
android:id="#+id/relativeLayout1"
android:layout_width="wrap_content"
android:layout_height="20dp"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_below="#+id/search_lay"
android:layout_marginTop="1dp"
android:background="#e8e8e8" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="32dp"
android:text="Item(s)"
android:textColor="#dd1713"
android:textSize="13sp" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="48dp"
android:layout_toRightOf="#+id/textView1"
android:text="Price(Rs.)"
android:textColor="#dd1713"
android:textSize="13sp" />
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="18dp"
android:layout_toRightOf="#+id/textView3"
android:text="Qty"
android:textColor="#dd1713"
android:textSize="13sp" />
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginLeft="28dp"
android:layout_toRightOf="#+id/textView2"
android:text="Total(Rs.)"
android:textColor="#dd1713"
android:textSize="13sp" />
<TextView
android:id="#+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="3dp"
android:text="Fav"
android:textColor="#dd1713"
android:textSize="13sp" />
</RelativeLayout>
Customized List-view XML Coding
<?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" >
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:background="#ffffff" >
<TextView
android:id="#+id/orderlist_product_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView"
android:visibility="gone" />
<RelativeLayout
android:layout_width="30dp"
android:layout_height="match_parent" >
<ImageView
android:id="#+id/fav_img"
android:layout_width="30dp"
android:layout_height="30dp"
android:background="#drawable/fav_order_list_btn" />
<Button
android:id="#+id/special_inst_btn"
android:layout_width="25dp"
android:layout_height="18dp"
android:layout_below="#+id/fav_img"
android:layout_centerHorizontal="true"
android:background="#drawable/special_inst_btn_in_orderlist"
android:gravity="center"
android:text="+"
android:textColor="#ffffff"
android:textSize="14sp" />
</RelativeLayout>
<TextView
android:id="#+id/order_list_itemname"
android:layout_width="95dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="1dp"
android:text="Item name"
android:textColor="#000000"
android:textSize="12sp"
android:typeface="serif" />
<RelativeLayout
android:layout_width="34dp"
android:layout_height="match_parent"
android:layout_marginLeft="2dp" >
<TextView
android:id="#+id/orderlist_offer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="4dp"
android:gravity="center"
android:textColor="#298616"
android:textSize="10sp" />
<TextView
android:id="#+id/orderlist_price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:gravity="right"
android:text="200.00"
android:textColor="#000000"
android:textSize="10sp"
android:typeface="serif" />
</RelativeLayout>
<Button
android:id="#+id/orderlist_minus"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:layout_marginTop="1dp"
android:background="#drawable/sub_button_click" />
<EditText
android:id="#+id/order_list_quantity"
android:layout_width="27dp"
android:layout_height="25dp"
android:layout_marginTop="13dp"
android:background="#drawable/et_bg"
android:ems="10"
android:focusable="false"
android:focusableInTouchMode="false"
android:gravity="center"
android:inputType="number"
android:textColor="#000000"
android:textSize="12dp"
android:typeface="serif" >
<requestFocus />
</EditText>
<Button
android:id="#+id/orderlist_plus"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_gravity="center"
android:layout_marginTop="1dp"
android:background="#drawable/plus_btn_click" />
<TextView
android:id="#+id/orderlist_total"
android:layout_width="43dp"
android:layout_height="wrap_content"
android:layout_marginLeft="3dp"
android:layout_marginTop="13dp"
android:gravity="right"
android:text="1000.00"
android:textColor="#000000"
android:textSize="11sp"
android:typeface="serif" />
<Button
android:id="#+id/orderlist_delete"
android:layout_width="23dp"
android:layout_height="23dp"
android:layout_gravity="center"
android:layout_marginLeft="3dp"
android:layout_marginTop="1dp"
android:background="#drawable/order_list_delete" />
</LinearLayout>
</RelativeLayout>
i m giving u a demo.this layout will work on all size layout,this will definitely help u #Yugesh.
weight works percentage-wise on all screen.
<?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" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical" >
<RelativeLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight=".30"
android:gravity="center_horizontal" >
<ImageView
android:id="#+id/image1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/ic_launcher" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/image1"
android:src="#drawable/ic_launcher" />
</RelativeLayout>
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight=".30"
android:text="30%" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight=".20"
android:text="20%" />
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight=".20"
android:text="20%" />
</LinearLayout>
</RelativeLayout>
further more,if there is any query,then please ask...

RelativeLayout - Scroll down

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>

Categories

Resources