I have problem with getting information which part of view has been clicked. I have child row item defined as:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/child_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="@dimen/row_height"
android:background="@color/app_white" >
<CheckBox
android:id="@+id/checkbox"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="@dimen/row_margin"
android:button="@drawable/checkbox_states"
android:focusable="false" />
</RelativeLayout>
<View
android:id="@+id/view"
android:layout_width="fill_parent"
android:layout_height="10dp"
android:background="@android:color/transparent"
android:focusable="false" />
</LinearLayout>
和在活动我需要定义 儿童点击
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition,
int childPosition, long id) {
Log.e(LOGTAG, "onChildClick: v.getTag: " + v.getTag() + " groupPos: " + groupPosition
+ " childPosition: " + childPosition + " rowId: " + id);
if (v instanceof LinearLayout) {
View view = ((LinearLayout) v).getChildAt(1);
if (view != null) {
if (view.getTag() != null) {
Log.e(LOGTAG, "onChildClick: view.isSelected: "+view.isSelected());
Log.e(LOGTAG, "onChildClick: view.isPressed: "+view.isPressed());
Log.e(LOGTAG, "onChildClick: view.getTag: " + view.getTag());
return true;
}
}
}
从我可以看到的视图总是线性拉尤特。 如果点击视图或相对拉尤特, 我如何获得信息?