加入您的layout.xml

android:descendantFocusability="blocksDescendants"

希望按照主(父)布局代码它会工作。并设置以下属性在你的WebView

android:focusable="false"

android:focusableInTouchMode="true"

See it:

xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"

android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"

android:paddingRight="@dimen/activity_horizontal_margin"

android:paddingTop="@dimen/activity_vertical_margin"

android:descendantFocusability="blocksDescendants"

android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivityFragment">

android:layout_width="match_parent"

android:layout_height="match_parent"

android:focusable="false"

android:focusableInTouchMode="false">

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐