2016-06-16 74 views
0

看起来非常简单,但是不能得到这个正确的。看了很多例子,但是我要么填充整个屏幕的按钮或者填充整个屏幕的webview。我希望它看起来像这样(与web视图填充屏幕无论在什么分辨率),除了底部将有2个按钮(是的,他们是丑陋的,但我将修复后):带底部按钮的WebView

enter image description here

当前的XML:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:id="@+id/ssoViewerLayout" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical" > 

     <WebView 
      android:id="@+id/ssoViewer" 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" 
      android:layout_weight="0"/> 

     <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
      xmlns:tools="http://schemas.android.com/tools" 
      android:layout_width="fill_parent" 
      android:layout_height="match_parent" 
      android:orientation="horizontal" 
      android:layout_height="0dip" 
      android:layout_weight="1" 
      android:gravity="center|bottom">  

      <Button 
       android:id="@+id/cancelSSO" 
       android:layout_marginTop="16dp" 
       android:layout_width="125dp" 
       android:layout_height="55dp" 
       android:layout_margin="5dp" 
       android:onClick="cancelSSOClick" 
       android:text="Cancel Login" 
       android:background="@drawable/button_login" /> 
      <Button 
       android:id="@+id/resetSSO" 
       android:layout_marginTop="16dp" 
       android:layout_width="125dp" 
       android:layout_height="55dp" 
       android:layout_margin="5dp" 
       android:onClick="resetSSOClick" 
       android:text="Reset SSO" 
       android:background="@drawable/button_login"/> 
    </LinearLayout> 
</LinearLayout> 

谢谢!

UPDATE

由于Arpit拉坦的回答,与一对夫妇的修改得到它的工作。最终的XML看起来像:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
      xmlns:tools="http://schemas.android.com/tools" 
      android:id="@+id/ssoViewerLayout" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" > 

      <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
       xmlns:tools="http://schemas.android.com/tools" 
       android:id="@+id/button_layout" 
       android:layout_width="match_parent" 
       android:orientation="horizontal" 
       android:layout_height="wrap_content" 
       android:gravity="center|bottom" 
       android:layout_alignParentBottom="true">  

       <Button 
        android:id="@+id/cancelSSO" 
        android:layout_marginTop="16dp" 
        android:layout_width="125dp" 
        android:layout_height="55dp" 
        android:layout_margin="5dp" 
        android:onClick="cancelSSOClick" 
        android:text="Cancel Login" 
        android:background="@drawable/button_login" /> 
       <Button 
        android:id="@+id/resetSSO" 
        android:layout_marginTop="16dp" 
        android:layout_width="125dp" 
        android:layout_height="55dp" 
        android:layout_margin="5dp" 
        android:onClick="resetSSOClick" 
        android:text="Reset SSO" 
        android:background="@drawable/button_login"/> 
     </LinearLayout> 
    <WebView 
       android:id="@+id/ssoViewer" 
       android:layout_width="fill_parent" 
       android:layout_height="fill_parent" 
       android:layout_above="@id/button_layout" /> 
    </RelativeLayout> 

回答

2

将其更改为:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
      xmlns:tools="http://schemas.android.com/tools" 
      android:id="@+id/ssoViewerLayout" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" > 


       <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
        xmlns:tools="http://schemas.android.com/tools" 
        android:id="@+id/button_layout" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:orientation="horizontal" 
       android:layout_height="0dip" 
       android:gravity="center|bottom" 
       android:alighParentBottom="true">  

       <Button 
        android:id="@+id/cancelSSO" 
        android:layout_marginTop="16dp" 
        android:layout_width="125dp" 
        android:layout_height="55dp" 
        android:layout_margin="5dp" 
        android:onClick="cancelSSOClick" 
        android:text="Cancel Login" 
        android:background="@drawable/button_login" /> 
       <Button 
        android:id="@+id/resetSSO" 
        android:layout_marginTop="16dp" 
        android:layout_width="125dp" 
        android:layout_height="55dp" 
        android:layout_margin="5dp" 
        android:onClick="resetSSOClick" 
        android:text="Reset SSO" 
        android:background="@drawable/button_login"/> 
     </LinearLayout> 
    <WebView 
       android:id="@+id/ssoViewer" 
       android:layout_width="fill_parent" 
       android:layout_height="fill_parent" 
       android:layout_above="@id/button_layout" /> 
    </RelativeLayout> 
0

这可能是你需要把一个片段的东西,我见过这样的事情兵戎相见其他房地产,尤其是跨不同的设备。