質問

私の設定から、ブラウザではなくWebViewでリンクを開きたいです。何か案は?

これが私のXMLの一部です:

 <PreferenceCategory
      android:title="@string/about">
     <PreferenceScreen
            android:title="@string/eula"
            android:summary="">
        <intent android:action="android.intent.action.VIEW"
                android:data="http://www.tara.com/m/EULA.aspx" />
    </PreferenceScreen>

    <PreferenceScreen
            android:title="@string/privacy_policy"
            android:summary="">
        <intent android:action="android.intent.action.VIEW"
                android:data="http://www.tara.com/m/Legal/Privacy.aspx" />
    </PreferenceScreen>
    <PreferenceScreen
            android:title="@string/version"
            android:summary="@string/version_name">
    </PreferenceScreen>

    <PreferenceScreen
            android:title="@string/customer_support"
            android:summary="@string/email_description">
            <intent android:action="com.tara.android.turboweather.EMAIL_ACCUWX"
             />
    </PreferenceScreen>
    <PreferenceScreen
            android:title="@string/branding"
            android:summary="">
    </PreferenceScreen>        
</PreferenceCategory>

したがって、URLがどこにあるかは、携帯電話のブラウザを開くのではなく、Android WebViewを開きたいと思います。

役に立ちましたか?

解決

優先項目でクリックリスナーを使用し、クリックしたらアクティビティを開きます。

XMLで、設定スクリーンを好みで交換し、キーを与えます

<Preference android:title="About"
            android:summary="Details about the app"
            android:key="aboutPref" />

次に、優先アクティビティで、優先ファイルを読み込んだ後:

Preference pref = findPreference( "aboutPref" );
pref.setOnPreferenceClickListener( myListener );

MyListenerは、アクティビティを起動し、URLを渡して意図的な追加データを開くために渡す内部クラスのインスタンスです。

よろしく、ステファン

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top