Qam*_*man 6 android android-layout android-webview
我有线性布局,其中只包含WebView.我想要做的是禁用Webview中的单击,这意味着我希望调用与RelativeLayout bg_stepsContainer关联的事件.我用过android:clickable ="false"这是代码
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="30dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:id="@+id/bg_stepsContainer"
>
<LinearLayout
android:id="@+id/stepslcontainer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:clickable="false"
android:focusable="false"
android:focusableInTouchMode="false" >
<WebView
android:id="@+id/bg_stepsToReproduce"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="false"
android:focusable="false"
android:focusableInTouchMode="false"
android:textColor="@color/solid_black" />
</LinearLayout>
<ImageView
android:id="@+id/stepsArrow"
android:layout_width="10dp"
android:layout_height="10dp"
android:layout_alignParentRight="true"
android:clickable="false"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
android:layout_centerVertical="true"
android:src="@drawable/ic_right_arrow" />
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
任何建议都得到赞赏!
shi*_*tya 24
mWebView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
return true;
}
});
Run Code Online (Sandbox Code Playgroud)
使用android:clickable ="false"不会禁用触摸事件.
| 归档时间: |
|
| 查看次数: |
11269 次 |
| 最近记录: |