2014-09-03 3 views
2

나는이안드로이드 GRIDVIEW 이동 한 열은

enter image description here

만에 두 개의 열이 같이있는 gridview 외모에 옮겨 열을 구현해야합니다. 나는 어댑터이 사용 다른 유형을 시도하지만 내가있는 gridview를 확장 및 방법을 onDraw는 ovverride 할 것이다 나에게 보인다 enter image description here

내 임무가 해결되지하지만 어쩌면 이미 다른 솔루션 또는 라이브러리 존재?

+0

는'GridLayout'를 사용합니다. 그것은 균일하지 않은 그리드를 허용합니다. 지원 라이브러리 가져 오기를 통해 구형 장치에서도 사용할 수 있습니다. –

답변

0

레이아웃 XML 파일을 통해이 작업을 수행 할 수 있습니다.

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:orientation="vertical" > 

<LinearLayout 
    android:id="@+id/header" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:padding="5dp" > 

    <ImageView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     /> 

</LinearLayout> 

<GridView 
    android:id="@+id/grid" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:layout_below="@id/header" 
    android:cacheColorHint="#0000" 
    android:columnWidth="100dp" 
    android:horizontalSpacing="5dp"   
    android:numColumns="2" 
    android:stretchMode="columnWidth" 
    android:verticalSpacing="5dp" /> 

</RelativeLayout> 
2

아래 링크를 참조하십시오. 코드를 참조하십시오. 희망이 도움이 될 것입니다. StaggeredGridView

AsymmetricGridView

+0

StraggeredGridView - 내가 필요한 것. Thx, 시도합니다. –