2013-02-21 2 views
2

그래서 일부 텍스트와 버튼이있는 간단한 레이아웃이 있습니다. 텍스트는 시작 부분에 배치되며 일부 휴대 전화에서는 화면 높이가 더 높아져서 스크롤보기에 배치됩니다. 해당 텍스트 옆에 하나 이상의 textview 및 화면의 오른쪽 아래에 배치해야하는 단추가 있습니다. 문제는 하나의 커다란 스크린이 내 버튼이 바닥에 있지 않고 텍스트가 끝나는 곳이며, 내 상대방 레이아웃이 scrollView의 전체 높이를 차지하지 않는다는 것을 알 수 있습니다. 내 레이아웃 :내 상대 레이아웃이 전체 화면 높이를 사용하지 않는 이유는 무엇입니까?

<ScrollView 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" > 

<RelativeLayout 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" > 

    <TextView 
     android:id="@+id/text1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentTop="true" 
     android:text="Some dummy text" 
     android:textColor="#969696" 
     android:textSize="13dp" /> 




    <TextView 
     android:id="@+id/text2" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentTop="false" 
     android:layout_below="@+id/text1" 
     android:text="some dummy text2" 
     android:textColor="#969696" 
     android:textSize="13dp" /> 



    <ImageButton 
     android:id="@+id/button1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true" 
     android:layout_alignParentRight="true" 
     android:src="@drawable/btn49_2x" /> 

</RelativeLayout> 

</ScrollView> 

내 실제 레이아웃은 좀 더 복잡하므로 상대 레이아웃을 사용해야합니다. 그러나 화면 높이 전체를 확인하는 방법은 무엇입니까?

높이를 wrap:content으로 설정했지만 효과가 없습니다.

+0

왜 layout_height = "fill_parent"로 설정하지 않으십니까? – Siddharth

+0

@idaNakav가 귀하의 문제를 해결할 것이라고 대답하십시오. – Prateek

+0

스크롤보기 때문에 스크롤보기를 제거하거나 ScrollView에서 android : fillViewport = "true"를 추가하십시오. –

답변

7

android:fillViewport="true"을 ScrollView에 추가하십시오.

+0

지옥 음침한! 그것은 u를 순전히 감사한다 작동한다! – gabrjan

관련 문제