안녕하세요 저는 헬프 활동을 디자인했고 각각의 특정 하위 항목이있는 종류의 부모 (groupItems)가 있습니다. 지금까지 문제가 없습니다. 그러나 ExpandableListView의 childItem은 기본적으로 클릭 할 수 있으므로 클릭하면 해당 항목이 깜박입니다. 그리고 정확히 내가 피하고 싶습니다! 내가하고 싶은 것을ExpandableListActivity childItems unclickable 만들기
public class HelpActivity extends ExpandableListActivity {
private static final String TAG = "HelpActivity";
private static final String PARENT = "parent";
private static final String CHILD = "child";
private List<HashMap<String,String>> parents;
private List<List<HashMap<String, String>>> childs;
public void onCreate(Bundle savedInstanceState) {
Log.i(TAG, "Instantiated new " + this.getClass());
super.onCreate(savedInstanceState);
setContentView(R.layout.help);
parents = createParentList();
childs = createChildList();
SimpleExpandableListAdapter expListAdapter = new SimpleExpandableListAdapter(
this,
parents, // Describing data of group List
R.layout.help_group_item, // Group item layout XML.
new String[] {PARENT}, // the key of group item.
new int[] {R.id.row_name}, // ID of each group item.-Data under the key goes into this TextView.
childs, // childData describes second-level entries.
R.layout.help_child_item, // Layout for sub-level entries(second level).
new String[] {CHILD}, // Keys in childData maps to display.
new int[] {R.id.grp_child} // Data under the keys above go into these TextViews.
);
setListAdapter(expListAdapter); // setting the adapter in the list.
}
/* Creating the Hashmap for the row */
private List<HashMap<String,String>> createParentList() {
ArrayList<HashMap<String,String>> result = new ArrayList<HashMap<String,String>>();
HashMap<String,String> m = new HashMap<String,String>();
m.put(PARENT,getResources().getString(R.string.help_parent_1));
result.add(m);
m = new HashMap<String,String>();
m.put(PARENT,getResources().getString(R.string.help_parent_2));
result.add(m);
m = new HashMap<String,String>();
m.put(PARENT,getResources().getString(R.string.help_parent_3));
result.add(m);
return result;
}
/* creatin the HashMap for the children */
private List<List<HashMap<String, String>>> createChildList() {
ArrayList<List<HashMap<String, String>>> result = new ArrayList<List<HashMap<String, String>>>();
for (int i=0;i<parents.size();i++){
HashMap<String, String> sec = parents.get(i);
ArrayList<HashMap<String, String>> secChild = new ArrayList<HashMap<String, String>>();
HashMap<String,String> child = new HashMap<String,String>();
if(sec.containsValue(getResources().getString(R.string.help_parent_1))){
child.put(CHILD, getResources().getString(R.string.help_child_1));
}else if(sec.containsValue(getResources().getString(R.string.help_parent_2))){
child.put(CHILD, getResources().getString(R.string.help_child_2));
}else if(sec.containsValue(getResources().getString(R.string.help_parent_3))){
child.put(CHILD, getResources().getString(R.string.help_child_3));
}else if(sec.containsValue(getResources().getString(R.string.help_parent_4))){
child.put(CHILD, getResources().getString(R.string.help_child_4));
}
secChild.add(child);
result.add(secChild);
}
return result;
}
}
이 여기
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView android:id="@+id/grp_child"
android:paddingLeft="20dp"
android:textSize="15dp"
android:textStyle="normal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
콘텐츠로 채워집니다 모든 (이 작동) 어떻게 내 소스 코드 내가 차일에 사용하는 레이아웃입니다 Textview를 자식보기를 취소 할 수 없도록 만드는 것입니다. 이미 텍스트 뷰 속성을 시도했지만 아무도 영향을받지 않았습니다.
android:clickable="false"
android:focusable="false"
android:enabled="false"
아이디어를 가지고있는 사람에게 미리 감사드립니다!
좋아요, 나는 이미 나오지 않았어 생각 그렇게 어려운 일이 아닙니다. 그냥 시도해 보았습니다. 완벽하게 작동합니다. 고맙습니다. – Vossi