我有一個WebView
其中有一個RelativeLayout
父。 在WebView
當我點擊某個特定按鈕時,它會加載另一個網址。我想禁用該網址上的鍵盤。以及我在shouldoverrideurlloading(WebView視圖,Url Url)方法中獲得的url。Android:如何禁用某些特定頁面的webview上的鍵盤?
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/background"
android:gravity="center_horizontal"
android:orientation="vertical"
tools:context="com.xenopsi.benchmark.BrowserActivity">
<WebView
android:id="@+id/browserView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:scrollbars="none"/>
</RelativeLayout>
在這個方法我做:
relativeLayout.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
webView.setFocusable(false);
webView.setFocusableInTouchMode(true);
,但仍當我在該網頁的文本字段挖掘,鍵盤仍然所示。 如果我做了onCreate()
活動的方法相同的代碼,其工作正常,
但我的問題是想在我的頁面加載時禁用它的方法shouldOverrideUrlLoading
。
參考[此](http://stackoverflow.com/a/30440309/5148289)回答 –
我已經嘗試過,所有的事情在oncreate方法中工作,但我想爲特定頁面執行此操作時,shouldOverrideUrlLoading方法檢測到我的網址。對於其他頁面,我想顯示我的鍵盤,但不是該頁面。 – ankur