2011-06-10 3 views
0

scrollview에서 두 개의 textviews가있는 상대적 레이아웃이 있고 textview 중 하나에 android : layout_alignParentBottom = "true"속성이 있습니다. 이 텍스트 뷰를 화면의 테두리에 정렬 할 수 있습니까?android layout stuff

<?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" 
     > 
<RelativeLayout 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent"> 

    <TextView 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:text="blabla"/> 

    <TextView 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:layout_alignParentBottom="true" 
      android:text="blabla2"/> 

</RelativeLayout> 

</ScrollView> 

답변

0

TextView를 맨 아래에 정렬하고 나머지는 스크롤 할 수있게하려는 경우. 그러면 레이아웃이 이렇게 보일 것입니다.

<?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"> 
<ScrollView android:layout_width="fill_parent" 
    android:layout_height="fill_parent"> 
    <RelativeLayout android:layout_width="fill_parent" 
     android:layout_height="fill_parent"> 
     <TextView android:layout_width="fill_parent" 
      android:layout_height="wrap_content" android:text="blabla" /> 
    </RelativeLayout> 
</ScrollView> 
<TextView android:layout_width="fill_parent" 
    android:layout_height="wrap_content" android:layout_alignParentBottom="true" 
    android:text="blabla2" /> 
    </RelativeLayout> 

희망이 있습니다.

+0

장래에 여러 항목에 페이지가 나타날 수 있기 때문에 모든 항목을 스크롤 할 수 있기를 원하지만 화면 하단에 항목 하나를 유지해야합니다. –

+0

내가 틀렸을 때 정정하십시오. 스크롤 할 수있는 n-1 개 항목을 원하고 blabla2 인 n 번째 항목은 항상 화면 맨 아래에 있어야하며 항상 사용자에게 표시되어야합니다. 이것이 사실이라면 ScrollView 안에 언급 된 RelativeLayout에 n-1 개의 뷰를 모두 추가하면됩니다. 따라서 n-1 화면은 화면 이동 가능하며 n 번째 화면은 항상 하단에 고정됩니다. – Gopal

+0

그래서 내보기에는 6 개 항목이어야합니다. 인물 사진에서 마지막 사진은 화면 하단에 있어야합니다. (모두 hdpi 장치의 세로 모드에 맞고, mdpi는 맞지 않습니다.) 가로 방향으로는 적합하지 않으므로 이것을 넣어야합니다. 스크롤바 ... –

관련 문제