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

리스트뷰에 버튼이 쭉~~ 나열되는거 어찌해야하죠?

0 추천

 

 

 

1.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/linear_write_frame"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <include
        layout="@layout/header_with_menu"
        android:id="@+id/header_with_menu"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" />
        <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="120dp"
        android:background="@drawable/box"
        android:paddingTop="10dp" >

        <ImageView 
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/profile"
            android:id="@+id/iv_profile_img"
            />
        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_toRightOf="@id/iv_profile_img"
            android:text="이름......."
            android:id="@+id/et_profile_nm"
            />
        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_toRightOf="@id/iv_profile_img"
            android:layout_below="@id/et_profile_nm"
            android:textSize="5pt"
            android:textColor="#FFFFFF"
            android:text="자기소개......"
            />
    </RelativeLayout>
    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textSize="7pt"
        android:textColor="#FFFFFF"
        />
    <ListView
        android:id="@+id/lv_write_list"
        android:layout_height="wrap_content"
        android:layout_width="fill_parent"></ListView>
</LinearLayout>

 

 

 

2.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
    <Button 
		android:layout_width="fill_parent"
		android:layout_height="wrap_content"
		android:paddingTop="10dp"
		android:background="@drawable/btn_normal_long"
		/>
</LinearLayout>

커스텀레이아웃을 하려고, 위와 같이 2개의 레이아웃을 두고...

1번은 setContentView에서 설정합니다.

2번은 getView에서 설정을하고요.

헌데, 궁금한게... ArrayList의 갯수만큼 버튼이 출력되도록 하려는건데요.

2번째에서 XML레이아웃상에서 버튼은 하나뿐인데, 리스트뷰에서 여러건을 출력하려면 어찌해야하는지 감이 안잡혀서요...

뽀그 (520 포인트) 님이 2013년 9월 30일 질문

1개의 답변

0 추천
 
채택된 답변
커스텀 리스트뷰를 올리셨으면 다 되셨네요.

리스트뷰에 올리는 아이템 개수를 늘려보세요.

그러면 2번의 레이아웃이 아이템 개수만큼 나올거에요.
아나콘다v (4,670 포인트) 님이 2013년 10월 1일 답변
뽀그님이 2013년 10월 10일 채택됨
...