2

私はAndroidアプリケーションが初めてです。webview 内でレイアウトを表示する方法があるかどうか疑問に思っていますか? 例えば。

WebView webview = (WebView)findViewById(R.id.webView1);
webview.getSettings().setJavaScriptEnabled(true);
webview.getSettings().setBuiltInZoomControls(true);
String url = "Layout location or R.Layout.test";
webview.loadUrl(url); 

これは、Activity クラスを使用してこのようなレイアウトを表示する以外は同じです setContentView(R.layout.test);

WebView でレイアウトを表示しようとしています。

どんな考えでも大歓迎です。

4

4 に答える 4

0

明確にするために、レイアウトのロードにWebビューを使用することはできません。

このリンクを確認してください

http://developer.android.com/reference/android/webkit/WebView.html

于 2013-02-01T04:38:03.563 に答える
0

チュートリアルで見たものは何でも、レイアウトをINTOにロードしていないWebView可能性がありalong withWebView.

つまり、HTML の div に似たレイアウトを実際に使用できます。レイアウトを取得し、そこに Webview を追加してから、lgw150 で示されているように、webview タグの外側にボタンやその他のコントロールを追加します。

これは、ボタンなどが webview 内にあるという印象を与えるかもしれませんが、実際にはそうではありません! あなたはこのようなものを持つことができます:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
             android:layout_height="fill_parent"
             android:layout_width="fill_parent"
             android:orientation="vertical">
    <LinearLayout
        android:orientation="horizontal"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content">
        <Button android:id="@+id/button1"
            android:layout_width="0dip"
            android:layout_height="wrap_content"                
            android:layout_gravity="top"
            android:layout_weight="1"/>
        <Button android:id="@+id/button2"
            android:layout_width="0dip"
            android:layout_height="wrap_content"                
            android:layout_gravity="top"
            android:layout_weight="1" />
    </LinearLayout>
    <WebView 
        android:id="@+id/webview"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"/>

詳細については、これこれもチェックしてください。私の回答の左側にあるチェックマークをクリックしてください。

于 2013-02-01T05:06:13.717 に答える
0

webview内のレイアウトを表示しますか?私は明確に理解していません.以下はおそらくあなたのための例です

<ProgressBar
android:id="@+id/progWeb"
style="@style/progressbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/darker_gray"
android:max="100"
android:visibility="invisible" />

<WebView
android:id="@+id/web"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/progWeb"
android:layout_marginTop="28dp" />
于 2013-02-01T04:27:30.187 に答える
0

いいえ、できません。コンパイルされたアプリケーションにはリソース XML が含まれていません。内部形式に変換されます。

http://www.atcomm.com.au/Atcomm-Underground/Java/Compiled-and-Noncompiled-Android-Resources.html

http://developer.android.com/tools/building/index.html

于 2013-02-01T05:00:08.797 に答える