2013-07-18 3 views
0

enter image description here동일 수직 간격 열

내가 내 응용 프로그램 내 메인 화면이 레이아웃을 만들고 싶어 레이아웃. 위에 표시된 각 이미지 블록에 줄무늬가 있습니다. 이 작업을 수행하려면 어떤 레이아웃 (RelativeLayout, LinearLayout ... 등)을 사용해야합니까? 저는 안드로이드 개발에 초보자입니다. 몇 가지 레이아웃을 실험했지만 성공하지 못했습니다. FrameLayout도 사용했습니다.

<?xml version="1.0" encoding="utf-8"?> 
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:stretchColumns="1"> 

     <TableRow> 
      <FrameLayout 
       android:id="@+id/inboxLargeButton" 
       android:layout_height="wrap_content" 
       android:layout_width="0dp" 
       android:layout_weight="1"> 

       <ImageView android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:src="@drawable/inbox_normal" 
        android:id="@+id/buttonWeddingDayCheatSheet" 
        android:layout_gravity="center_horizontal"> 
       </ImageView> 
       <TextView 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:text="2631" 
        android:layout_gravity="bottom" 
        android:gravity="center" 
        android:textColor="#fff" 
        android:textSize="50dp" /> 
      </FrameLayout> 

      <FrameLayout 
       android:layout_height="wrap_content" 
       android:layout_width="0dp" 
       android:layout_weight="1"> 
       <ImageView android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:src="@drawable/outbox_normal" 
        android:id="@+id/buttonShareFavoriteRecipe" 
        android:layout_gravity="center_horizontal"> 
       </ImageView> 
       <TextView 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:text="0296" 
        android:layout_gravity="bottom" 
        android:gravity="center" 
        android:textColor="#fff" 
        android:textSize="50dp" /> 
       </FrameLayout> 
     </TableRow> 

     <TableRow> 
      <FrameLayout 
       android:layout_height="wrap_content" 
       android:layout_width="0dp" 
       android:layout_weight="1"> 

       <ImageView android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:src="@drawable/header_left_normal" 
        android:id="@+id/buttonWeddingDayCheatSheet" 
        android:layout_gravity="center_horizontal"> 
       </ImageView> 
       <TextView 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:text="Most sent" 
        android:layout_gravity="bottom" 
        android:gravity="center" 
        android:textColor="#fff" 
        android:textSize="15dp" /> 
      </FrameLayout> 

      <FrameLayout 
       android:layout_height="wrap_content" 
       android:layout_width="0dp" 
       android:layout_weight="1"> 
       <ImageView android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:src="@drawable/header_right_normal" 
        android:id="@+id/buttonShareFavoriteRecipe" 
        android:layout_gravity="center_horizontal"> 
       </ImageView> 
       </FrameLayout> 
     </TableRow> 
     <TableRow> 
      <FrameLayout 
       android:layout_height="wrap_content" 
       android:layout_width="0dp" 
       android:layout_weight="1"> 

       <ImageView android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:src="@drawable/body_left_normal" 
        android:id="@+id/buttonWeddingDayCheatSheet" 
        android:layout_gravity="center_horizontal"> 
       </ImageView> 
      </FrameLayout> 

      <FrameLayout 
       android:layout_height="wrap_content" 
       android:layout_width="0dp" 
       android:layout_weight="1"> 
       <ImageView android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:src="@drawable/body_right_normal" 
        android:id="@+id/buttonShareFavoriteRecipe" 
        android:layout_gravity="center_horizontal"> 
       </ImageView> 
       </FrameLayout> 
     </TableRow> 
    </TableLayout> 

마찬가지로 각 블록을 클릭 가능하게하고 싶습니다.

+0

을하지만, 아마도 안드로이드 '와 관련된 : stretchColumns = "1"' – njzk2

+0

그것의 이미, 안드로이드 : stretchColumns = "1" – UsmanAzam

+0

예 그게 내가 말하는거야. 균일 한 분포를 원할 경우 특히 열을 늘리지 말아야합니다. – njzk2

답변

0

이 코드를보십시오 : 문제가 명확하게 언급되지

<?xml version="1.0" encoding="utf-8"?> 
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:stretchColumns="1" > 

    <TableRow 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" > 

     <LinearLayout 
      android:id="@+id/inboxLargeButton" 
      android:layout_width="0dp" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:orientation="vertical" > 

      <ImageView 
       android:id="@+id/buttonWeddingDayCheatSheet" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_gravity="center_horizontal" 
       android:src="@drawable/ic_launcher" > 
      </ImageView> 

      <TextView 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:layout_gravity="bottom" 
       android:gravity="center" 
       android:text="2631" 
       android:textColor="#fff" 
       android:textSize="50dp" /> 
     </LinearLayout> 

     <LinearLayout 
      android:layout_width="0dp" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:orientation="vertical" > 

      <ImageView 
       android:id="@+id/buttonShareFavoriteRecipe" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_gravity="center_horizontal" 
       android:src="@drawable/ic_launcher" > 
      </ImageView> 

      <TextView 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:layout_gravity="bottom" 
       android:gravity="center" 
       android:text="0296" 
       android:textColor="#fff" 
       android:textSize="50dp" /> 
     </LinearLayout> 
    </TableRow> 

    <TableRow 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" > 

     <LinearLayout 
      android:layout_width="0dp" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:orientation="vertical" > 

      <ImageView 
       android:id="@+id/buttonWeddingDayCheatSheet" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_gravity="center_horizontal" 
       android:src="@drawable/ic_launcher" > 
      </ImageView> 

      <TextView 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:layout_gravity="bottom" 
       android:gravity="center" 
       android:text="Most sent" 
       android:textColor="#fff" 
       android:textSize="15dp" /> 
     </LinearLayout> 

     <LinearLayout 
      android:layout_width="0dp" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:orientation="vertical" > 

      <ImageView 
       android:id="@+id/buttonShareFavoriteRecipe" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_gravity="center_horizontal" 
       android:src="@drawable/ic_launcher" > 
      </ImageView> 
     </LinearLayout> 
    </TableRow> 

    <TableRow 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" > 

     <LinearLayout 
      android:layout_width="0dp" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:orientation="vertical" > 

      <ImageView 
       android:id="@+id/buttonWeddingDayCheatSheet" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_gravity="center_horizontal" 
       android:src="@drawable/ic_launcher" > 
      </ImageView> 
     </LinearLayout> 

     <LinearLayout 
      android:layout_width="0dp" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:orientation="vertical" > 

      <ImageView 
       android:id="@+id/buttonShareFavoriteRecipe" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_gravity="center_horizontal" 
       android:src="@drawable/ic_launcher" > 
      </ImageView> 
     </LinearLayout> 
    </TableRow> 

</TableLayout> 
+0

솔루션이 효과가 있다고 생각하는 이유에 대한 설명/설명이 필요합니까? (모든 코드를 거치고 싶지 않은 사람들에게 좋을 것이다) – njzk2