2012-02-23 161 views
0

我正在使用andorid。我想創建這樣一個佈局: -Android我應該使用哪種佈局

enter image description here

當我再轉動我的Android設備應該是這樣的: -

enter image description here

必須有這些圖像之間的一些填充。請建議我如何執行此操作。我應該爲此使用哪種類型的佈局。 我在等你的建議。你可以給我發一些與此相關的鏈接。

預先感謝您。

回答

1

使用GridLayout顯示圖像。這對於方向更改很容易就能正常工作。在這裏我發佈了一個sample code

您需要刪除文本的代碼。

Download images在本例中使用。

+0

謝謝pankaj先生,,,謝謝大家誰試圖幫助我... – 2012-02-28 11:49:57

+0

@Pushpendra Kuntal你最歡迎。 – 2012-02-28 12:21:00

1

使用網格佈局或TableLayout不錯的教程,但你必須寫條件根據取向

1

這段代碼可以幫助你:

<TableLayout 
android:id="@+id/tableLayout1" 
android:layout_height="wrap_content" 
android:layout_width="fill_parent" 
android:layout_marginTop="10dip"> 

    <TableRow android:id="@+id/tableRow1" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:padding="10dip"> 
     <TextView android:id="@+id/textView1" 
     android:text="@string/name" 
     android:textColor="@color/black" 
     android:textAppearance="?android:attr/textAppearanceMedium" 
     android:paddingRight="5dip" 
     android:layout_weight=".30" 
     android:width="0dip"></TextView> 

      <TextView android:id="@+id/name_value" 
     android:text="AAA" 
     android:textColor="@color/black" 
     android:textAppearance="?android:attr/textAppearanceMedium" 
     android:paddingLeft="5dip" 
     android:singleLine="false" 
     android:layout_weight=".70" 
     android:width="0dip"></TextView> 

    </TableRow> 

用這種方式,你可以控制的填充或保證金的任何DP不管你想要的。屏幕方向更改可以控制佈局。 您可以更改:

android:layout_weight=".30" 

來控制每列的​​寬度。

這是一個工作代碼。