2016-08-14 2 views
0

좋아, 그래서 내가 listview에서 나란히 이미지 뷰가있는 레이아웃을 만들려고 노력하고있어. Here은 내가 성취하려는 것의 한 예일 것입니다. 그러나, 어떻게해야하는지 잘 모르겠습니다. 다음은 내가 온라인에서 찾은 예입니다. 문제는 더 많은 이미지 뷰를 추가하기 시작하면 이미지 뷰를 현재 행 아래에 있지 않고 같은 행에 추가한다는 것입니다.어떻게 여러 ImageView를 나란히 배치 할 수 있습니까?

<LinearLayout 
xmlns:android="http://schemas.android.com/apk/res/android" 
android:orientation="horizontal" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:paddingTop="15dip" 
      android:paddingBottom="15dip"> 
<ImageView android:id="@+id/numberDays" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:scaleType="fitStart" 
     android:layout_weight="1" 
     android:src="@drawable/placeholder1" /> 
<ImageView android:src="@drawable/placeholder1" 
     android:layout_height="wrap_content" 
     android:layout_width="wrap_content" 
     android:scaleType="fitStart" 
     android:layout_weight="1" 
     android:id="@+id/daysText"></ImageView> 

</LinearLayout> 

이러한 이미지를 나란히 표시하는 더 나은 방법은 listview가 좋을까요, 아니면 XML로 그렇게해야합니까?

+0

gridview를 사용하여 – Ramit

+0

https://developer.android.com/guide/topics/ui/layout/gridview.html – Ramit

+0

이미지 수가 고정되어 있지 않으면 ListView 또는 RecyclerView가 더 좋습니다. RecyclerView 및 GridLayoutManager를 사용할 것을 권장합니다. 여기에 예제가 있습니다. http://blog.sqisland.com/2014/12/recyclerview-grid-with-header.html?m=1 – nshmura

답변

1

이에 대한 그리드 뷰를 사용하고이

안드로이드 사용해야한다 : 당신의 GRIDVIEW XML에 numColumns의 = "를".

+0

나는 이것을 밖으로 시도하고 다시보고 할 것입니다. – Alex

관련 문제