GestureOverlayView에서 하위 요소로 TextView를 가져 오려고합니다. 여기 Android의 GestureOverlayView에서 하위 항목 가져 오기
내보기 XML 코드 :<RelativeLayout android:layout_width="fill_parent" android:id="@+id/relativeLayout1" android:layout_height="wrap_content">
<android.gesture.GestureOverlayView android:layout_height="wrap_content" android:id="@+id/gestureOverlayView1" android:layout_width="wrap_content" android:layout_alignParentTop="true" android:layout_alignParentRight="true" android:layout_alignParentLeft="true">
<LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:id="@+id/linearLayout2" android:layout_height="wrap_content">
<LinearLayout android:orientation="horizontal" android:weightSum="1" android:layout_width="260dp" android:id="@+id/linearLayout1" android:layout_height="wrap_content" android:baselineAligned="false" android:layout_weight="0.32">
<CheckBox android:id="@+id/sListCheckbox" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="0.32"></CheckBox>
<TextView android:text="TextView" android:id="@+id/sListText" android:layout_width="212dp" android:ems="15" android:layout_gravity="center" android:textAppearance="?android:attr/textAppearanceLarge" android:singleLine="true" android:layout_height="wrap_content" android:layout_weight="0.32"></TextView>
</LinearLayout>
<ImageView android:paddingRight="0dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:layout_weight="0.32" android:id="@+id/imageView1" android:src="@drawable/searchbutton"></ImageView>
</LinearLayout>
</android.gesture.GestureOverlayView>
</RelativeLayout>
그리고 난 같은 텍스트 뷰에 도달하려고하지만 난
adapterLine.gestureOverlayView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if (gestureDetector.onTouchEvent(event)) {
RelativeLayout llt = (RelativeLayout) v.getParent();
TextView childText = (TextView) llt.getChildAt(4);
프로그램이 충돌하는 행은 무엇입니까? 예외/오류 로그를 게시 할 수 있습니까? 내 생각 엔 당신이 올바른 부모보기를 얻지 못한다는 것입니다. 코드를 게시하십시오 v. – Jack
null을 반환하는 childText – cagryInside