2013-06-19 3 views
0

레이아웃이 여러 개 있고 각 레이아웃 외부에 이미지 뷰가 있으므로 하나의 컨테이너 아래에서 모든 레이아웃을 래핑하고 컨테이너를 스크롤하려고합니다. 여러 가지 방법이 있지만 그 결과로 내가 원하는 것은 아닙니다. 조금만 도와 주시면 감사하겠습니다. 여기 이 레이아웃의 ScrollView가 작동하지 않습니다

내 XML 코드 : 자동으로 포장됩니다

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> 
+1

ScrollView의 위치는 어디입니까 ?? 그것을 부모 레이아웃으로 만들고 있습니까 ?? –

+0

나는 여기에 언급하지 않았다. 왜냐하면 나는 그것을 넣을 때 끔찍한 것처럼 보이기 때문이다. 부모 레이아웃이 아니라 단지 내 컨테이너 레이아웃 위에 배치하는 방법을 알아야 할 뿐이다. –

+0

ScrollView는 부모 레이아웃이어야하고 Relative는 자식이어야합니다. 왜냐하면 ScrollView에는 직접 자식이 하나만있을 수 있다는 제약이 있기 때문입니다. 그래서 당신이 그것을 돌볼 수 있는지 확인하십시오 –

답변

2

내가있는 ScrollView를 단지 컨테이너 선택 포장 용기에 마우스 오른쪽 버튼을 클릭하여있는 ScrollView와 컨테이너 레이아웃을 포장 b를 그것을 해결하고 선택하는 관리의 특정 속성.

관련 문제