2012-01-20 15 views
3

私はちょうどそれをしたいが、私は方法がわからない。これは垂直線形レイアウトになります。私は3時間捜して、まだ役に立たない何も見つけていない。半画面のAndroidウェブビュー

+0

チェックアウトこの質問:http://stackoverflow.com/質問/ 4315332/how-to-create-two-view-in-android-that-use-50-height-each-one-is-small-small – jorgenfb

+0

@Tomi S:こんにちは私は問題に直面しています... if google.comを開くかyahoo.comとWebビュー(高さ= 200dp)し、最初の200dpを表示します空のWebビューを開いてからgoogle/yahooのページをフルスクリーンで開きます...私はちょうどwww.ya.comで試してみます。 – CoDe

+0

ここに同じ...私は任意のリンクをクリックすると、それは同じ200dpの高さwebview ....これ以上の任意のアイデアで開く代わりに、新しいフルスクリーンページを開きますか? – CoDe

答えて

2

私はこれを以前に2つのwebviewで行っていました。私はアンドロイド:layout_weightを1に設定してWebビューを作成し、それを画面に表示しました。

ウェブビューが1つだけの場合は、残りのアイテムに別の線形レイアウトを使用し、webviewと線形レイアウトの両方にandroid:layout_weight = "1"を設定します。

0
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     android:orientation="vertical" 
     android:layout_height="wrap_content" 
     android:layout_width="fill_parent"    
     android:weightSum="1"> 

Webブラウザボタン

button = (Button) findViewById(R.id.btn_webbrowser); 
button.setOnClickListener(new OnClickListener() 
{ 
    public void onClick(View arg0){ 
     Intent i = new 
     Intent(android.content.Intent.ACTION_VIEW, 
    Uri.parse(“http://www.amazon.com”)); 
startActivity(i); 
    } 
}); 
5

互いに等しく、あなたの子ビューの重みを設定すると、均等に分割する必要があります。

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:orientation="vertical" > 

    <WebView 
     android:layout_width="fill_parent" 
     android:layout_height="0dp" 
     android:layout_weight="1" /> 

    <Space 
     android:layout_width="fill_parent" 
     android:layout_height="0dp" 
     android:layout_weight="1" /> 
</LinearLayout> 
+0

正しい例をありがとう、しかし、nithinreddyが最初に答えたので、私は彼をチェックしなければなりません。 –

関連する問題