2011-09-09 2 views
0

scrollview를 추가하기 전까지는 레이아웃이 완벽했습니다.Android UI dificulties

<?xml version="1.0" encoding="utf-8"?> 
<TableLayout android:id="@+id/tableLayout1" android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android"> 
    <ScrollView android:id="@+id/scrollView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" > 
     <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:id="@+id/linearLayout1"> 
      <TableLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/tableLayout1"/> 
     </LinearLayout> 
    </ScrollView> 
    <Button android:layout_width="match_parent" android:id="@+id/button1" android:text="Start" android:layout_height="50dip" android:onClick="getOutput"></Button> 
</TableLayout> 

나는 화면 하단에 머물 수있는 버튼을 싶습니다, 나는 실제로있는 ScrollView는 전체 화면을 차지하는 것처럼. 내부 테이블 레이아웃만으로도 잘 작동합니다. 그래픽 레이아웃 미리보기에서는 원하는 방식으로 보이지만 실행하면 보이지 않습니다. 어떤 제안?

아래쪽에 있기를 원하는 버튼을 제외하고 전체 화면을 차지하도록 scrollview를 사용하고 싶습니다. Like this

+1

은 왜 이것에 대한 TableLayout을를 사용하는 일을해야합니까? 버튼이 화면 아래쪽에 머무르게한다고 말하면 스크롤 뷰에서 가능한 것이 전체 화면을 차지하고 있습니까? 아마도 당신은 당신이 원하는 것을 더 분명하게 묘사 할 수있을 것입니다. –

+0

왜 테이블 레이아웃 내부에 스크롤 뷰가 필요한지 잘 모르겠습니다. 스크롤 뷰 내부에 테이블 레이아웃을 갖는 것이 더 일반적입니다. – SK9

+0

나는 그것을 시도했는데, 어떤 이유로 작동하지 않을 것인가? 왜 내가 tablelayout에 가서 시도했는지, 내가 원한 것에 가장 근접하게되었다는 이유, LinearLayout과 RelativeLayout을 시도하고있다. – sjensen85

답변

0

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" android:layout_height="fill_parent" 
    android:orientation="vertical"> 
    <ScrollView android:layout_width="fill_parent" android:layout_height="0dip" 
     android:layout_weight="1.0"> 
     <LinearLayout android:layout_width="fill_parent" 
      android:layout_height="fill_parent" android:orientation="vertical" 
      android:id="@+id/linearLayout1"> 
      <TableLayout android:layout_width="fill_parent" 
       android:layout_height="fill_parent" 
       android:id="@+id/tableLayout1"/> 
     </LinearLayout> 
    </ScrollView> 
    <Button android:layout_width="fill_parent" android:layout_height="wrap_content" 
     android:text="Bottom Button"/> 
</LinearLayout> 
+0

나는 이것을 전에 시도해 보았고, 다시 내 앱을 만든다. 닫기 – sjensen85

+0

위로 스택 추적을 넣으십시오. – blessenm

+0

그래도 시도하지 않았다 (또는 전에 참조하십시오) 0dip에서 layout_height, 감사합니다! – sjensen85

0

ScrollView fillViewport 속성을 true로 설정해보십시오.

1

루트보기로 RelativeLayout 또는 LinearLayout을 사용할 수 있습니다. 더 많은 버튼을주는 버튼. 그렇게하면 ScrollView가 모든 것을 차지하지 않습니다.