2012-10-11 3 views
0

나는 앱을 만들려고하는데 화면에 모두 맞지 않습니다. 나는 다른 것들 사이에서 스크롤보기를 사용하려고 시도하고 그냥 기울이지 않을 것 같습니다. 테이블이 필요하고 테이블을 스크롤 할 수있게 만드시겠습니까? 스크롤 뷰를 사용하면 선형 레이아웃이되지만 상대 레이아웃을 사용하고있는 것처럼 보입니다. 여기에있는 다른 답변들 중 아무 것도 작동하지 않는 것 같습니다. 당신은 볼 수는 매우 좁아xml android application 스크롤 가능한 상대 레이아웃

enter image description 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:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:background="@drawable/black_white" 
android:orientation="vertical" > 

<Button 
    android:id="@+id/North" 
    style="?android:attr/buttonStyleSmall" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignParentLeft="true" 
    android:layout_alignParentTop="true" 
    android:background="@android:color/black" 
    android:text="North" 
    android:textColor="@android:color/white" /> 

<Button 
    android:id="@+id/East" 
    style="?android:attr/buttonStyleSmall" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignParentTop="true" 
    android:layout_toRightOf="@+id/North" 
    android:background="@android:color/black" 
    android:text="East" 
    android:textColor="@android:color/white" /> 

<Button 
    android:id="@+id/South" 
    style="?android:attr/buttonStyleSmall" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_above="@+id/address" 
    android:layout_alignParentRight="true" 
    android:background="@android:color/black" 
    android:text="South" 
    android:textColor="@android:color/white" /> 

<Button 
    android:id="@+id/West" 
    style="?android:attr/buttonStyleSmall" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_above="@+id/address" 
    android:layout_toLeftOf="@+id/South" 
    android:background="@android:color/black" 
    android:text="West" 
    android:textColor="@android:color/white" /> 

<CheckedTextView 
    android:id="@+id/address" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_alignParentLeft="true" 
    android:layout_alignParentRight="true" 
    android:layout_below="@+id/North" 
    android:background="@android:color/black" 
    android:text="Address" 
    android:textColor="@android:color/white" /> 


<Button 
    android:id="@+id/Button01" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignParentBottom="true" 
    android:layout_alignParentRight="true" 
    android:layout_toRightOf="@+id/East" 
    android:background="@android:color/black" 
    android:gravity="center_vertical|center_horizontal" 
    android:text="Visit Website" 
    android:textColor="@android:color/white" /> 

<EditText 
    android:id="@+id/editText1" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignParentLeft="true" 
    android:layout_below="@+id/address" 
    android:ems="10" 
    android:inputType="textMultiLine" 
    android:text="address" > 

    <requestFocus /> 
</EditText> 


<Button 
    android:id="@+id/button1" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignParentRight="true" 
    android:layout_below="@+id/editText1" 
    android:layout_toRightOf="@+id/East" 
    android:background="@android:color/black" 
    android:gravity="center_vertical|center_horizontal" 
    android:text="Map &amp; Directions" 
    android:textColor="@android:color/white" /> 

<CheckedTextView 
    android:id="@+id/CheckedTextView01" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_alignParentLeft="true" 
    android:layout_below="@+id/button1" 
    android:layout_marginTop="14dp" 
    android:background="@android:color/black" 
    android:text="Phone" 
    android:textColor="@android:color/white" /> 

<ImageView 
    android:id="@+id/imageView2" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_below="@+id/CheckedTextView01" 
    android:layout_marginTop="20dp" 
    android:layout_toLeftOf="@+id/East" 
    android:src="@drawable/aphone" /> 


<EditText 
    android:id="@+id/editText2" 
    style="?android:attr/buttonStyleSmall" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignParentRight="true" 
    android:layout_alignTop="@+id/imageView2" 
    android:layout_toRightOf="@+id/East" 
    android:background="@android:color/black" 
    android:ems="10" 
    android:gravity="center_vertical|center_horizontal" 
    android:hint="Call Us" 
    android:inputType="phone" 
    android:text="1-614-555-5555" 
    android:textColor="@android:color/white" /> 

<CheckedTextView 
    android:id="@+id/CheckedTextView02" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_alignParentLeft="true" 
    android:layout_below="@+id/editText2" 
    android:layout_marginTop="15dp" 
    android:background="@android:color/black" 
    android:text="E-Mail" 
    android:textColor="@android:color/white" /> 

<ImageView 
    android:id="@+id/imageView3" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignLeft="@+id/imageView2" 
    android:layout_below="@+id/CheckedTextView02" 
    android:layout_marginTop="17dp" 
    android:src="@drawable/themail" /> 


<Button 
    android:id="@+id/button2" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignLeft="@+id/editText2" 
    android:layout_alignParentRight="true" 
    android:layout_alignTop="@+id/imageView3" 
    android:background="@android:color/black" 
    android:gravity="center_vertical|center_horizontal" 
    android:text="Send Message" 
    android:textColor="@android:color/white" /> 

<CheckedTextView 
    android:id="@+id/CheckedTextView03" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_above="@+id/Button01" 
    android:layout_alignParentLeft="true" 
    android:background="@android:color/black" 
    android:text="Website" 
    android:textColor="@android:color/white" /> 

<ImageView 
    android:id="@+id/imageView1" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignLeft="@+id/imageView2" 
    android:layout_alignTop="@+id/button1" 
    android:src="@drawable/mapicon" /> 

</RelativeLayout> 
+0

수를 match_parent로 설정 layout_width와 높이를 설정해야합니다 안에있는 ScrollView 당신의 RelativeLayout의를 넣어 [RelativeLayout scrollview]의 복제본 (http://stackoverflow.com/questions/4657687/rel) ativelayout-scrollview) – Sam

답변

0

당신이

<?xml version="1.0" encoding="utf-8"?> 
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:fillViewport="true" > 

    <RelativeLayout 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
android:background="@drawable/black_white" 
android:orientation="vertical" > 

put your other stuff here 
. 
. 
. 

</RelativeLayout> 
</ScrollView> 
+0

내가 뭘 잘못하고 있는지 알지만 작동하지. android : layout_width 및 android : layout_height가 잘못되었습니다. – user1738212