2013-12-07 31 views
0

我用下面的佈局:如何更正佈局以顯示按鈕?

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:gravity="center" 
       android:orientation="vertical" 
       android:padding="10dp"> 

     <TextView 
      android:id="@+id/wizard6_title" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:paddingBottom="10dp" 
      android:scrollbars="vertical" 
      android:text="@string/wizard6_title" 
      android:textColor="#0088cc" 
      android:textSize="20sp" 
      android:textStyle="bold" /> 
    <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="0dp" 
      android:layout_marginTop="0dp" 
      android:orientation="vertical" 
      android:layout_weight="1"> 
     <TextView 
      android:id="@+id/wizard6_text1" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:gravity="fill_horizontal" 
      android:scrollbars="vertical" 
      android:text="@string/wizard6_text1" 
      android:textSize="18sp" /> 
     <Button 
       android:id="@+id/wizard6_btn_file" 
       android:layout_height="wrap_content" 
       android:layout_width="match_parent" 
       android:text="@string/wizard6_btn_file" /> 
    </LinearLayout> 
    <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginTop="10dp" 
      android:layout_marginBottom="10dp"> 
     <Button 
       android:id="@+id/wizard6_btn_back" 
       android:layout_width="0dp" 
       android:layout_height="wrap_content" 
       android:layout_weight="1" 
       android:text="@string/wizard_back" /> 
     <Button 
       android:id="@+id/wizard6_btn_next" 
       android:layout_width="0dp" 
       android:layout_height="wrap_content" 
       android:layout_weight="1" 
       android:text="@string/wizard_next" /> 
    </LinearLayout> 
</LinearLayout> 

wizard6_text1文本有滾動(mTextView5.setMovementMethod(new ScrollingMovementMethod())),但在小屏幕所花費的剩餘空間和wizard6_btn_file不顯示結果。我應該如何解決它?

+0

您是否在清單中的活動中嘗試了? – Sigrlami

+0

@Sigrlami,剛剛嘗試過 - 它沒有幫助。 –

+0

你可以發佈幾個截圖嗎? – Sigrlami

回答

1

任何時候你有這樣的麻煩可能是因爲你沒有設置佈局權重。 Android默認使用0,這意味着需要所有需要的空間。嘗試添加到您的textview與大量的文字:

android:layout_weight="1" 

希望它有幫助!

+0

謝謝,它有幫助。 –