마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

커스텀 리스트뷰 레이아웃

0 추천


     

 

 

    <LinearLayout
        android:orientation="horizontal"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:gravity="top"
        android:layout_gravity="top">

        <ImageView
            android:id = "@+id/mImage"
            android:layout_width="40dp"
            android:layout_height="40dp"
            android:src="@drawable/ohmq"
            android:layout_marginRight="15dp"
            android:layout_marginLeft="8dp" />

        <LinearLayout
            android:orientation="vertical"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:gravity="center_vertical"
            android:layout_gravity="top">

            <TextView
                android:id="@+id/mText"
                android:text = "Text"
                android:textColor="#212121"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textAppearance="?android:attr/textAppearance"
                android:textSize = "15dp"/>
        </LinearLayout>

    </LinearLayout>
</LinearLayout>

 

커스텀 레이아웃 설정시 맨 위부터 list-up 되었으면 좋겠는데,

자꾸 가운데로 되네요..

방법을 아신다면 도와주세요!

후니02 (820 포인트) 님이 2016년 1월 19일 질문

2개의 답변

0 추천
 
채택된 답변
제가 질문을 잘 못 이해할 수도 있는데..

listview의 height를 wrap_content로 설정하신거 아닌지요... (거기다 더해서 gravity가 center계열일듯 하네요..)

match_parent로 설정해보시는게...

저 layout자체는 리스트의 cell을 지정하는거라...
귀찮근 (2,960 포인트) 님이 2016년 1월 20일 답변
후니02님이 2016년 1월 20일 채택됨
답변 감사합니다! 네 listView를 wrap_content로 해놨더라구요.. match_parent로 했더니 제대로 잘 되네요~
엉뚱한데서 헤매고 있었군요. 감사합니다!
0 추천

fill_parent 는 deprecated 되었으니 가능한 match_parent 사용하세요 

  <LinearLayout
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_height="match_parent"

aucd29 (218,390 포인트) 님이 2016년 1월 19일 답변
답변 감사합니다. 허나.. 달라지는게 없는데요? 계속 가운데 있어요.
...