2013-06-14 4 views
2

내 프로젝트에서 새 활동을 만들어야하고 사진을 보여주고 싶습니다. 내가 만들고자하는 레이아웃은 그와 같습니다.Android 레이아웃 방향 문제

enter image description here

모든 높이는 "wrap_content"속성이 있어야합니다.

어떤 레이아웃을 사용해야합니까?

+0

는 두 정상 그리드의 "wrap_content"를 사용하여 자신의 높이의 평등을 보장하지 않는다는 것을 이해해야합니다. –

+0

그래서 3 개의 GridLayouts를 넣으시겠습니까? – dumbfingers

+0

API 레벨 14가 필요하기 때문에 GridLayout을 사용하고 싶지 않습니다. –

답변

3

이 주제 이동에 대한 자세한 정보를 위해이 시도 :

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

    <LinearLayout 
     android:layout_width="fill_parent" 
     android:layout_height="0dp" 
     android:layout_weight="1" 
     android:orientation="horizontal" > 

     <GridView 
      android:layout_width="0dp" 
      android:layout_height="fill_parent" 
      android:layout_weight="66" > 
     </GridView> 

     <GridView 
      android:layout_width="0dp" 
      android:layout_height="fill_parent" 
      android:layout_weight="33" > 
     </GridView> 
    </LinearLayout> 

    <GridView 
     android:layout_width="fill_parent" 
     android:layout_height="0dp" 
     android:layout_weight="1" > 
    </GridView> 
</LinearLayout> 

을 : 당신은 그냥 확인 속성을 대신의 GridView의 다른보기를 사용할 수 있습니다 동일합니다.

This is what you're looking for

0

StaggeredGridView를 만들고 싶습니다.

StaggeredGridView는 Android의 실험용 StaggeredGridView의 수정 된 버전입니다. StaggeredGridView를 사용하면 Pinterest의 모양과 비슷한 고르지 않은 행을 가진 GridView를 만들 수 있습니다. 자체 OnItemClickListener 및 OnItemLongClickListener, 선택기 및 고정 위치 복원을 포함합니다.

this 라이브러리를 사용하십시오.

희망이 도움이 :)

0

아이들에을 layout_weight를 TableLayout 또는 GridView 사용을 고려하고 속성 을 사용합니다.

첫 자식 (66 %)은 다음에 제 아이 폭의 2/3 (66 %)을 차지하는 2 레이아웃 중량, 제 (33 %) 1.

의 레이아웃을 가질 수있다 두 번째 자녀는 1/3, 즉 33 %입니다.

그리고 layout_span 속성을 사용하면 두 열의 마지막보기가 확장됩니다. 예를 들어

:

<TableLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:stretchColumns="*" > 

    <TableRow> 

     <TextView 
      android:layout_width="0dp" 
      android:layout_height="wrap_content" 
      android:layout_weight="2"/> 
    <TextView 
      android:layout_width="0dp" 
      android:layout_height="wrap_content" 
      android:layout_weight="1"/> 
    </TableRow> 

    <TableRow> 

     <TextView 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_span="2" /> 
    </TableRow> 
</TableLayout> 

또한에 layout_weight에 대한 설명은 that question를 참조하십시오.