안드로이드 개발 질문/답변
(글 수 45,052)
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:focusable="true"
android:focusableInTouchMode="true"
android:orientation="vertical" > <LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#f7adce"
android:orientation="horizontal" > <Button
android:id="@+id/read_homeBTN"
android:layout_width="20dp"
android:layout_height="48dp"
android:layout_marginTop="5dp"
android:layout_weight="1"
android:onClick="onClickFunc"
android:text="뒤로" /> <ImageView
android:id="@+id/img_bitmap"
android:layout_width="45dp"
android:layout_height="45dp"
android:layout_gravity="center"
android:layout_marginLeft="20dp"
android:src="@drawable/ic_launcher" /> <TextView
android:id="@+id/read_nicknameTXT"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginLeft="15dp"
android:layout_weight="3"
android:gravity="left|center_vertical"
android:textColor="#000"
android:textSize="18sp"
android:textStyle="bold" /> <Button
android:id="@+id/read_editBTN"
android:layout_width="20dp"
android:layout_height="48dp"
android:layout_marginTop="5dp"
android:layout_weight="1"
android:onClick="onClickFunc"
android:text="메뉴" />
</LinearLayout> <ScrollView
android:id="@+id/read_contentScroll"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="3" > <LinearLayout
android:id="@+id/read_contentLinear"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
> <TextView
android:id="@+id/readTXT"
android:layout_width="wrap_content"
android:layout_height="wrap_content" /> <ImageView
android:id="@+id/read_image"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:contentDescription="image/jpeg"
android:scaleType="matrix" /> <ListView
android:id="@+id/commentLST"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:stackFromBottom="true" />
</LinearLayout>
</ScrollView> <LinearLayout
android:id="@+id/editLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content" > <EditText
android:id="@+id/readSendEDT"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3"
android:hint="댓글을 입력해 주세요" /> <Button
android:id="@+id/readSendBTN"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:onClick="onBTNFunc"
android:text="전송" />
</LinearLayout></LinearLayout>
지금 리스트뷰를 댓글 입력할때마다 밑으로 쭈욱 뿌려주고 싶은데 리스트뷰가 한줄밖에안보이네요
리스트뷰 높이를 지정해주면 댓글이 보이긴한데 그 높이를 넘어서면 다시 댓글이 숨는 현상이 있어서
높이지정도 못해주겠구요
이거 어떤식으로 해결하면 될까요?
구현할려고 하는게 textview imageview listview 를 한화면처럼 스크롤할수있게 구현할려고 하고 있습니다.
조언좀 부탁드려요
2012.05.23 09:10:28
Adapter 에서 getCount() 를 오버라이드 해서 아답터에 연결한 배열의 사이즈를 리턴하도록 해주세요
리스트뷰에 데이터 바인딩을 할 아답터에 꼭 오버라이드 해야할 메쏘드가 몇개 있는데
getView, getCount, getItem, getPosition 정도는 꼭 오버라이드 해주세요
2012.08.14 02:30:56
글 내용중에 'listview 한줄밖에 안보이는데 조언좀해주세요' 라는
내용을 보았습니다. 지금 몇주째 이것과 같은 해결을 못해서 끙끙앓고있습니다.
갖은 방법 다 활용해서 했는데 안되더군요..소스도없고 위의 소스는 페이스북과 동일 형태의 소스인데 단순히 생각한것과는 차이가 많이 났습니다. add.head 방법으로했는데 저희는 listview의 값이 5개까지만 보이더군요..그이상은 보여지지가 않습니다.
괜찮으시다면 저문제를 해결하셨다면 어떻게 해결하셨는지좀 알수있을까요?
정말 저 해결방안 및 조언이 너무나 필요해서 그렇습니다. 꼭 좀 부탁드리겠습니다.




리스트를 둘러싼 리니어 레이아웃의
android:layout_height="fill_parent"를 wrap_content로 바꾸세요