TouchDelegate를 올바로 설정하고 있는지 궁금합니다. LinearLayout 내에서 TextViews의 터치 영역을 늘리고 싶습니다.TouchDelegate가 TextView의 터치 영역을 늘리지 않고 있습니다.
내 레이아웃은 다음과 같습니다.
<LinearLayout
android:id="@+id/subcategory"
android:layout_width="fill_parent"
android:layout_height="35dp"
android:background="#000000"
android:gravity="center_horizontal"
android:orientation="horizontal"
android:padding="5dp" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="30dp"
android:paddingRight="30dp"
android:text="All"
android:textColor="#FFFFFF"
android:textSize="18sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="30dp"
android:paddingRight="30dp"
android:text="None"
android:textColor="#FFFFFF"
android:textSize="18sp" />
</LinearLayout>
나는 subCategoryLayout가
subCategoryLayout.post(new Runnable() {
@Override
public void run() {
for (int i = 0; i < subCategoryLayout.getChildCount(); i++) {
Rect delegateArea = new Rect();
TextView d = (TextView) subCategoryLayout.getChildAt(i);
d.getHitRect(delegateArea);
delegateArea.bottom += 50;
delegateArea.top += 200;
delegateArea.left += 50;
delegateArea.right += 50;
TouchDelegate expandedArea = new TouchDelegate(delegateArea, d);
subCategoryLayout.setTouchDelegate(expandedArea);
// if (View.class.isInstance(d.getParent())) {
// ((View) d.getParent()).setTouchDelegate(expandedArea);
// }
}
}
});
문제가 해결 되었습니까? 나는 똑같은 문제를 겪고있다. 터치 위임을 사용하는 – hshed
은 실제로 터치 영역을 늘리지 못했습니다. – heero