2012-02-23 159 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" 

来控制每列的​​宽度。

这是一个工作代码。