2014-11-24 48 views
0

我即將開始爲片段構建我的xml佈局,但我不確定在表現和儘可能多的屏幕尺寸方面做什麼最好的方法。所有的 首先,這裏是佈局:特定佈局建議

enter image description here

所以我的問題是關於決定採用什麼樣的佈局?最簡單的方法是嵌套LinearLayout,但是我記得在某處看到它不適合演出...... 如果使用RelativeLayout,它是否真的能夠適應儘可能多的屏幕?或者如何去做? 另外,是否使用包含性能良好的元素?

我在尋求任何有關如何實現這一最佳方式的建議。

Thx!

回答

0

您可以使用線性佈局垂直與相對佈局在其中和在相對佈局中使用線性佈局水平和在線性佈局水平使用線性佈局垂直。

使用這種格式用於我們的代碼
襯墊佈局垂直 - >相對佈局 - >襯墊佈局水平 - >相對佈局 - >襯墊佈局垂直 - >的TextView

例如ü可以嘗試像TIS也。 ..

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
tools:context="${relativePackage}.${activityClass}" > 

<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical" > 

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

     <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:layout_alignParentLeft="true" 
      android:layout_alignParentTop="true" > 

      <LinearLayout 
       android:layout_width="wrap_content" 
       android:layout_height="match_parent" 
       android:orientation="vertical" > 

       <TextView 
        android:id="@+id/textView1" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="TextView" /> 

       <TextView 
        android:id="@+id/textView2" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="TextView" /> 

       <TextView 
        android:id="@+id/textView3" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="TextView" /> 

      </LinearLayout> 

      <LinearLayout 
       android:layout_width="wrap_content" 
       android:layout_height="match_parent" 
       android:orientation="vertical" > 

       <TextView 
        android:id="@+id/textView4" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="TextView" /> 

       <TextView 
        android:id="@+id/textView5" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="TextView" /> 

       <TextView 
        android:id="@+id/textView6" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="TextView" /> 

      </LinearLayout> 

      <LinearLayout 
       android:layout_width="wrap_content" 
       android:layout_height="match_parent" 
       android:orientation="vertical" > 

       <TextView 
        android:id="@+id/textView7" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="TextView" /> 

       <TextView 
        android:id="@+id/textView8" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="TextView" /> 

       <TextView 
        android:id="@+id/textView9" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="TextView" /> 

      </LinearLayout> 

     </LinearLayout> 

    </RelativeLayout> 


</LinearLayout> 

</RelativeLayout> 

u能在烏拉圭回合項目中使用這樣的多文本視圖... 試試這個,它可以幫助ü....

thanxx。

編輯答案...

這裏使用

之間
<View 
    android:layout_height="1dp" 
    android:background= "#fff" 
    android:layout_width="match_parent" 
    /> 
+0

THX使得邊框!我會嘗試的!如何使邊界btw? – Makoto 2014-11-24 02:56:54

+0

這裏我已經添加了邊框的代碼檢查出來...請標記答案,如果你找到它的權利或upvote它@Makoto – 2014-11-24 04:05:35