I have an custom dialog, whick i am inflating from dialog.xml. when I open the dialog it looks something like shown below. I am getting some space between listview and the (OK) button below it. I want to eliminate this space between the list view and the Button below it.
How can i do this,?
dialog.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/RelativeLayout1"
android:layout_width="wrap_content"
android:layout_height="fill_parent" >
<ListView
android:id="#+id/listViewDialog"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:layout_above="#+id/button1"
android:layout_below="#+id/ImageView1" >
</ListView>
<CheckBox
android:id="#+id/checkBoxAll"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/listView1"
android:layout_alignParentRight="true"
android:layout_marginBottom="15dp"
android:layout_marginRight="25dp"
android:layout_marginTop="15dp"
android:text="" />
<ImageView
android:id="#+id/ImageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginBottom="15dp"
android:layout_marginLeft="14dp"
android:layout_marginTop="15dp"
android:background="#FFFFBB33"
android:contentDescription="#string/app_name"
android:scaleType="center"
android:src="#drawable/alert_dialog_icon" />
<TextView
android:id="#+id/textView1"
android:layout_width="128dp"
android:layout_height="match_parent"
android:layout_above="#+id/listViewDialog"
android:layout_marginBottom="15dp"
android:layout_marginTop="15dp"
android:layout_toRightOf="#+id/ImageView1"
android:gravity="center_vertical"
android:text="Categories"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView1"
android:layout_alignBottom="#+id/textView1"
android:layout_toLeftOf="#+id/checkBoxAll"
android:text="All"
android:textAppearance="?android:attr/textAppearanceLarge" />
<Button
android:id="#+id/button1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:text="OK" />
</RelativeLayout>
this is really easy..
you have 2 approchase:
1) create the root realtivelayout to have android:layout_height="wrap_cotent", and in the same time the ListView to have the same. this will shrink the sizes of the all dialog to the right (no space) size.
2) *more recomended , have the root to be a Linearlayout and give it some wightsum, then put the other views in this root, and give them some layout_wight, this way you know the in any screen resolution you have the same porportion of your screen.
maybe try like this:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/RelativeLayout1"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:weightSum="100" >
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/RelativeLayout1"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="15" >
<CheckBox
android:id="#+id/checkBoxAll"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/listView1"
android:layout_alignParentRight="true"
android:layout_marginBottom="15dp"
android:layout_marginRight="25dp"
android:layout_marginTop="15dp" />
<ImageView
android:id="#+id/ImageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginBottom="15dp"
android:layout_marginLeft="14dp"
android:layout_marginTop="15dp"
android:background="#FFFFBB33"
android:contentDescription="#string/app_name"
android:scaleType="center" />
<TextView
android:id="#+id/textView1"
android:layout_width="128dp"
android:layout_height="match_parent"
android:layout_above="#+id/listViewDialog"
android:layout_marginBottom="15dp"
android:layout_marginTop="15dp"
android:layout_toRightOf="#+id/ImageView1"
android:gravity="center_vertical"
android:text="Categories"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView1"
android:layout_alignBottom="#+id/textView1"
android:layout_toLeftOf="#+id/checkBoxAll"
android:text="All"
android:textAppearance="?android:attr/textAppearanceLarge" />
</LinearLayout>
<ListView
android:id="#+id/listViewDialog"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="70" >
</ListView>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="15" >
<Button
android:id="#+id/button1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="OK" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
Related
I have the following code with which i am trying to display at right corner of the title bar but its getting displayed in center.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="35dip"
android:gravity="center_vertical"
android:background="#drawable/formheader">
<ImageView
android:id="#+id/header"
android:background="#drawable/ic_launcher"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ShowRoom"
android:textColor="#android:color/black"
android:textStyle="bold"/>
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:clickable="true"
android:background="#drawable/menu"/>
</LinearLayout>
These are the properties of RelativeLayout, So it won't work with LinearLayout.
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
Add android:layout_weight="1" to TextView.
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="ShowRoom"
android:textColor="#android:color/black"
android:textStyle="bold" />
Change it like below :
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="35dip"
android:gravity="center_vertical"
android:orientation="horizontal" >
<ImageView
android:id="#+id/header"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/ic_launcher" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:text="ShowRoom"
android:textColor="#android:color/black"
android:textStyle="bold" />
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/ic_launcher"
android:clickable="true" />
</LinearLayout>
You can do it in 2 ways,
Follow #prag's answer if you want to continue with LinearLayout.
Another simplest way is to use RelativeLayout like below,
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="35dip"
android:gravity="center_vertical"
android:background="#drawable/formheader">
<ImageView
android:id="#+id/header"
android:background="#drawable/ic_launcher"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="#id/header"
android:layout_centerVertical="true"
android:text="ShowRoom"
android:textColor="#android:color/black"
android:textStyle="bold"/>
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:clickable="true"
android:background="#drawable/ic_launcher"/>
</RelativeLayout>
Try this layout
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="35dip"
android:orientation="horizontal" >
<ImageView
android:id="#+id/header"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/ic_launcher" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="ShowRoom"
android:textColor="#android:color/black"
android:textStyle="bold" />
<View
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1" >
</View>
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:background="#drawable/ic_launcher"
android:clickable="true" />
</LinearLayout>
Note: Replace my drawable image with yours. Hope this resolves your problem
The layout I'm designing appears fine in graphical layout but when I install it on the device it screws up.
Graphical Layout
On device
Here is my layout file.
<?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:background="#drawable/home_background"
>
<HorizontalScrollView
android:id="#+id/horizontalScrollView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/relativeLayout1"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginTop="81dp"
android:scrollbars="none"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
<ImageView
android:id="#+id/imageView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingRight="5dp"
android:src="#drawable/flipkart" />
<ImageView
android:id="#+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:src="#drawable/dominos" />
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:src="#drawable/flipkart" />
</LinearLayout>
</HorizontalScrollView>
<ImageView
android:id="#+id/dotted_separator"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:layout_alignParentLeft="true"
android:layout_below="#+id/relativeLayout1"
android:layout_marginTop="17dp"
android:paddingLeft="25dp"
android:paddingRight="25dp"
android:src="#drawable/dotted_separator" />
<RelativeLayout
android:id="#+id/relativeLayout1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:padding="30dp" >
<LinearLayout
android:id="#+id/title_holder"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<TextView
android:id="#+id/find_restaurant_coupons"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:text="Find Restaurant Coupons"
android:textColor="#ffffff"
android:textSize="15sp" />
</LinearLayout>
<LinearLayout
android:id="#+id/spinner_holder"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#id/title_holder"
>
<!--
<Spinner
android:id="#+id/city_spinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:entries="#array/city_spinner_data"
/>
-->
</LinearLayout>
<LinearLayout
android:id="#+id/location_search_holder"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/spinner_holder"
>
<EditText
android:id="#+id/input_location"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#ffffff"
android:ems="10"
android:hint="Location"
android:inputType="text"
android:padding="10dp"
android:textColor="#000000" >
<requestFocus />
</EditText>
<Button
android:id="#+id/button_go"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="#+id/input_location"
android:background="#17b851"
android:padding="10dp"
android:text="GO" />
</LinearLayout>
</RelativeLayout>
<Button
android:id="#+id/best_restaurants_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignRight="#+id/horizontalScrollView1"
android:layout_marginBottom="14dp"
android:layout_marginRight="42dp"
android:background="#17b851"
android:paddingLeft="25dp"
android:paddingRight="25dp"
android:text="Best Restaurants Offers" />
</RelativeLayout>
I dont understand what the problem was. I again stared with a blank file and copied each block one at a time to narrow down the problem but to my surprise this time it shows up properly.
I have a Back button on the top of my layout and i have placed the label text after that button. i need to center the label text, so that it should resemble like layout heading.Can anyone guide me on this task.
Hope u r looking for this
<RelativeLayout
android:id="#+id/header"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:background="#0fa2da" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="Text View"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="23sp" />
<Button
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:src="#drawable/white_bar" />
<Button
android:id="#+id/back_button"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_alignBottom="#+id/imageView1"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="5dp"
android:layout_marginRight="2dp"
android:layout_marginTop="2dp"
android:background="#148cba"
android:onClick="goBack"
android:text="Back"
android:textColor="#fff" />
</RelativeLayout>
Use this one:
<?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:orientation="vertical" >
<RelativeLayout
android:layout_width="match_parent"
android:background="#ff0000"
android:layout_height="60dp" >
<Button
android:id="#+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:text="Back" />
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/button1"
android:layout_alignBottom="#+id/button1"
android:layout_centerHorizontal="true"
android:text="Attractions"
android:textAppearance="?android:attr/textAppearanceMedium" />
</RelativeLayout>
</LinearLayout>
Edited Code as per your response
<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"
android:id="#+id/rlt1"
android:orientation="horizontal"
tools:context=".MainActivity" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#24a6c6">
<ImageButton
android:id="#+id/imageButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="10dp"
android:src="#drawable/back_btn_img" />
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="Attractions"
android:textColor="#fff"
android:textAppearance="?android:attr/textAppearanceMedium" />
</RelativeLayout>
In RelativeLayout try to set your TextView as android:center_horizontal="true"
I have made a simple application, with a background image, 4 image buttons and 4 text views in front of them.
I've read the google development documentation, but I still don't understand why in screens with a different size of 4,7" the app doesn't run normally. The textview is not in the right place. The image buttons are too small or too big in wrong places
I've created different images for differente resolutions (ldpi, mdpi, hdpi,xhdpi).
Here is the xml file:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/RelativeLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/gameinterface"
android:gravity="center_vertical"
android:orientation="vertical"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context=".QuestionsActivity" >
<LinearLayout
android:id="#+id/linearLayout4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginLeft="95dp"
android:layout_marginRight="10dp"
android:layout_marginTop="137dp"
android:orientation="vertical" >
<TextView
android:id="#+id/tvQuestion"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|center_vertical"
android:gravity="center_vertical|center_horizontal"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#android:color/white"
android:textSize="30sp" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true" >
<TextView
android:id="#+id/tvNumQuestion"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#B22222"
android:textSize="30sp" />
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="/20"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#B22222"
android:textSize="30sp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/linearLayout3"
android:layout_alignLeft="#+id/linearLayout4"
android:layout_marginBottom="114dp" >
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<ImageButton
android:id="#+id/btnR1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/selector"
android:src="#drawable/answerbutton" />
<TextView
android:id="#+id/tvR1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:textColor="#android:color/white"
android:textSize="10sp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp" >
<ImageButton
android:id="#+id/btnR3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/selector"
android:src="#drawable/answerbutton" />
<TextView
android:id="#+id/tvR3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:textColor="#android:color/white"
android:textSize="10sp" />
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<ImageButton
android:id="#+id/btnR2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/selector"
android:src="#drawable/answerbutton" />
<TextView
android:id="#+id/tvR2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:textColor="#android:color/white"
android:textSize="10sp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp" >
<ImageButton
android:id="#+id/btnR4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/selector"
android:src="#drawable/answerbutton" />
<TextView
android:id="#+id/tvR4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:textColor="#android:color/white"
android:textSize="10sp" />
</RelativeLayout>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
i have a layout that contain several layouts and outside each layout there is an imageview so i wraped all the layouts under one called container and i want the container to be scrolled i tried several ways but its not what i want as a result.
A little bit of help would be appreciated thank you.
Here is my xml code:
enter code here
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/inner_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/bg"
android:gravity="center_horizontal" >
<RelativeLayout
android:id="#+id/relativeLayout1"
android:layout_width="fill_parent"
android:layout_height="45dip"
android:background="#drawable/header"
android:paddingLeft="2dip"
android:paddingRight="2dip" >
<Button
android:id="#+id/sample_button"
style="#android:style/Widget.Button.Small"
android:layout_width="35dip"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginRight="10dip"
android:background="#drawable/burger" />
<TextView
android:id="#+id/actNAME"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:gravity="center"
android:text="Tickets"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#FFFFFF"
android:textStyle="bold"
tools:ignore="HardcodedText" />
</RelativeLayout>
///i want here the scrollview over the container layout
<RelativeLayout
android:id="#+id/container"
android:layout_width="300dp"
android:layout_height="390dp"
android:layout_below="#+id/relativeLayout1"
android:layout_centerHorizontal="true"
android:layout_marginTop="18dp"
android:background="#8DAE79" >
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="150dp"
android:layout_height="25dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="14dp"
android:layout_marginTop="14dp"
android:background="#drawable/bg" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:text="Ticket 1"
android:textColor="#FFFFFF"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout3"
android:layout_width="150dp"
android:layout_height="25dp"
android:layout_alignLeft="#+id/imageTicketTwo"
android:layout_below="#+id/imageTicketTwo"
android:layout_marginTop="18dp"
android:background="#drawable/bg" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:text="Ticket 3"
android:textColor="#FFFFFF"
android:textStyle="bold" />
</LinearLayout>
<ImageView
android:id="#+id/imageTicketThree"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/linearLayout3"
android:layout_alignParentRight="true"
android:layout_below="#+id/linearLayout3"
android:layout_marginTop="15dp"
android:background="#drawable/ticket_three" />
<LinearLayout
android:id="#+id/linearLayout4"
android:layout_width="150dp"
android:layout_height="25dp"
android:layout_alignLeft="#+id/imageTicketThree"
android:layout_below="#+id/imageTicketThree"
android:layout_marginTop="17dp"
android:background="#drawable/bg" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:text="Ticket 4"
android:textColor="#FFFFFF"
android:textStyle="bold" />
</LinearLayout>
<ImageView
android:id="#+id/imageTicketFour"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/linearLayout4"
android:layout_alignParentRight="true"
android:layout_below="#+id/linearLayout4"
android:layout_marginTop="15dp"
android:background="#drawable/ticket_four" />
<LinearLayout
android:id="#+id/linearLayout2"
android:layout_width="150dp"
android:layout_height="25dp"
android:layout_alignLeft="#+id/imageTicketOne"
android:layout_below="#+id/imageTicketOne"
android:layout_marginTop="15dp"
android:background="#drawable/bg" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:text="Ticket 2"
android:textColor="#FFFFFF"
android:textStyle="bold" />
</LinearLayout>
<ImageView
android:id="#+id/imageTicketTwo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/linearLayout2"
android:layout_alignParentRight="true"
android:layout_below="#+id/linearLayout2"
android:layout_marginTop="14dp"
android:background="#drawable/ticket_two" />
<ImageView
android:id="#+id/imageTicketOne"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/linearLayout1"
android:layout_marginLeft="10dp"
android:layout_marginTop="14dp"
android:background="#drawable/ticket_one" />
</RelativeLayout>
</RelativeLayout>
I managed to solve it b wrapping the container layout with a scrollView just by right click on the container select wrap container and choose Scrollview it will automatically wrap it with its specific attributes.