2015-05-19 3 views
0

Как сделать макет андроида для рисунка внизу? но я хочу, чтобы каждый столбец имеет одинаковую ширину enter image description hereКак сделать tablelayout с одинаковой шириной строки, в одной строке содержит две ячейки с одинаковой высотой

Я создал, но она не может быть такой же ширины для каждого столбца

<LinearLayout 
    android:orientation="horizontal" 
    android:layout_width="fill_parent" 
    android:weightSum="2" 
    android:layout_height="fill_parent"> 
    <TableLayout 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_weight="1" 
     android:background="#9812AC">   
     <TableRow> 
      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="100dip" 
       android:text="Happy Vendor3"> 
      </TextView> 
     </TableRow> 
    </TableLayout> 
    <TableLayout 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_weight="1">   
     <TableRow> 
      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="50dip" 
       android:text="Happy Vendor" 
       android:background="#000"> 
      </TextView> 
     </TableRow> 
     <TableRow> 
      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="50dip" 
       android:text="Happy Vendor2" 
       android:background="#CCC"> 
      </TextView> 
     </TableRow> 
    </TableLayout> 
</LinearLayout> 

Я просто попытался с помощью TextView, чтобы сделать его простым. Заранее спасибо.

ответ

0
<TableRow 
android:layout_width="fill_parent" 
android:layout_height="fill_parent"> 

<ImageView 
android:src="@drawable/someimage1" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:layout_weight=".5"/> 

<LinearLayout 
android:orientation="vertical" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:layout_weight=".5"> 

<ImageView 
android:src="@drawable/someimage2" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:layout_weight=".5"/> 

<ImageView 
android:src="@drawable/someimage3" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:layout_weight=".5"/> 

</LinearLayout> 
</TableRow> 
+0

он не работает, все ImageView будет отображаться как линейная компоновка с вертикальной ориентацией –

+0

Oops..I редактируемой моим ответа. – SmulianJulian

+0

Вы получили его? – SmulianJulian

0

enter image description here Попробуйте

<LinearLayout 
     android:orientation="horizontal" 
     android:weightSum="3" 
     android:layout_width="match_parent" 
     android:layout_height="250dp"> 

     <ImageView 
      android:layout_width="wrap_content" 
      android:layout_weight="2" 
      android:background="@color/red" 
      android:layout_height="match_parent" 
      android:id="@+id/imageView" /> 

     <LinearLayout 
      android:orientation="vertical" 
      android:layout_weight="1" 
      android:weightSum="2" 
      android:layout_width="0dp" 
      android:layout_height="match_parent"> 
      <ImageView 
       android:layout_width="match_parent" 
       android:layout_weight="1" 
       android:background="@color/black" 
       android:layout_height="0dp" 
       android:id="@+id/imageView2" /> 
      <ImageView 
       android:layout_width="match_parent" 
       android:layout_weight="1" 
       android:background="@color/blue" 
       android:layout_height="0dp" 
       android:id="@+id/imageView3" /> 
     </LinearLayout> 
    </LinearLayout> 
Смежные вопросы