2016-07-05 9 views
1

私はwebviewを持っていて、スクロールしてそこにスイッチが表示されています。 私の問題は、スイッチがwebviewの最後の行と重なっていることです。 親レイアウトのパディングを設定しようとしましたが、その問題はそのレイアウトが常に表示されることです。 Webビュー内に何かを追加して、下部にスペースを追加することはできますか?あるいは、周囲の相対レイアウト内に何かを追加することはできますか?以下のスペースをWebviewに追加

編集:

<RelativeLayout 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
    android:orientation="vertical"> 

<WebView 
    android:id="@+id/webView" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" /> 
</RelativeLayout> 

<android.support.v7.widget.SwitchCompat 
    android:id="@+id/opt_out_switch" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_alignParentBottom="true" 
    android:alpha="0" 
    android:background="#FFEFEEEE" 
    android:text="@string/optout" 
    android:theme="@style/switchTheme" /> 

<ProgressBar 
    android:id="@+id/progressBar" 
    style="@style/Widget.AppCompat.ProgressBar" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_centerInParent="true" 
    android:visibility="gone" /> 
</RelativeLayout> 
+0

あなたの投稿レイアウトで 'Switch'を持っていない - あなたは、プログラムを追加するには?どのようにそこに着きますか? – yennsarah

+0

全体のレイアウトファイルを投稿してください –

+0

投稿された全体のレイアウトファイル –

答えて

2

使用LinearLayoutあなたが必要なものを達成するために:

<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical"> 

    <WebView 
     android:id="@+id/webView" 
     android:layout_width="match_parent" 
     android:layout_height="0dp" 
     android:layout_weight="1" /> 

    <android.support.v7.widget.SwitchCompat 
     android:id="@+id/opt_out_switch" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:alpha="0" 
     android:background="#FFEFEEEE" 
     android:text="@string/optout" 
     android:theme="@style/switchTheme" /> 

    <ProgressBar 
     android:id="@+id/progressBar" 
     style="@style/Widget.AppCompat.ProgressBar" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" /> 
</LinearLayout> 
+0

私はスイッチを表示していません。 –

+0

あなたは 'android:alpha =" 0 "'を持っています。それを削除します –

+0

それはプログラム的に削除されます、私は相対的なレイアウトでそれを持っていると表示され、スクロールダウンします。 –

関連する問題