모든 행에 체크 박스와 텍스트 뷰 (사용자 정의 배경 포함)가있는 ListView를 만들었습니다. 행을 클릭하면 확인란과 텍스트 뷰가 listview 행으로 강조 표시되지만 행을 클릭하면 확인란과 텍스트 뷰없이 목록 뷰 행만 강조 표시됩니다. 제발 도와 주실 수 있나요?보기가없는 ListView 행을 강조 표시합니다.
이것은 행을 클릭 한 후 원하는 것입니다 : http://tinypic.com/r/14kfpza/5.
이것은 행을 클릭 한 후 있습니다 : http://tinypic.com/r/2mr5w9c/5.
는내 어댑터 목록보기 주셔서 감사합니다 :
public class MyAdapter<String> extends ArrayAdapter<String>{
Context ctx;
List<String> content;
public MyAdapter(Context context, List<String> objects) {
super(context, R.layout.listview_row ,objects);
this.ctx = context;
this.content = objects;
}
public View getView(int position, View convertView, ViewGroup parent){
View row = convertView;
if(row == null){
LayoutInflater inflater=getLayoutInflater();
row=inflater.inflate(R.layout.listview_row, parent, false);
}
TextView desc = (TextView)row.findViewById(R.id.textView1);
String name = content.get(position);
desc.setText(name.toString());
return row;
}
}
listview_row.xml : UR 목록보기 XML의
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="16dp"
android:layout_marginTop="16dp"
android:text="Large Text"
android:clickable="true"
android:focusable="false"
android:focusableInTouchMode="false"
android:background="@drawable/textview_bg"
android:textAppearance="?android:attr/textAppearanceLarge" />
<CheckBox
android:id="@+id/checkBox1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignTop="@+id/textView1"
android:layout_marginRight="5dp"
android:clickable="true"
android:focusable="false"
android:focusableInTouchMode="false"
android:text="" />
</RelativeLayout>
고맙지 만 작동하지 않습니다. – FilipR