Reputation: 7296
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>
Upvotes: 0
Views: 91
Reputation: 7296
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.
Upvotes: 2