문제

대화 상자로 표시하고 싶은 웹 뷰가 있습니다. WebView가 WebView의 콘텐츠의 양에 관계없이 대화 상자의 맨 아래에 머무르고 싶은 아래 버튼을 제외하고는 전체 화면을 채우기를 바랍니다. 현재 내 WebView는 화면에서 버튼을 누르기에 충분히 대화 상자를 채 웁니다. 나는 이것이 매우 쉬운 일이라고 확신하지만 내 인생의 경우 레이아웃,보기 및 속성 값의 마법 조합을 찾을 수 없었습니다. 명확하게 말해서, 나는 버튼이 webview 위에 떠 다니도록 그것을 얻었지만 웹 뷰가 버튼과 스크롤 바로 위에 멈추기를 바랍니다.

<RelativeLayout android:id="@+id/RelativeLayout01" 
                android:layout_width="fill_parent" 
                android:layout_height="fill_parent"
                xmlns:android="http://schemas.android.com/apk/res/android">
  <WebView android:id="@+id/webview"
           android:layout_width="fill_parent"
           android:layout_height="wrap_content"
           /> 
  <Button android:text="Ok" 
          android:id="@+id/btnOk" 
          android:layout_width="120px" 
          android:layout_height="wrap_content"
          android:layout_gravity="center_horizontal"
          android:layout_alignParentBottom="true"
          />
</RelativeLayout>
도움이 되었습니까?

해결책

WebView에 Android : layout_above = "@+id/btnok"을 사용하고 WebView의 너비와 높이에 대해 fill_parent를 사용하려고합니다.

그러나 1.5 이하에서 XML에서 올바르게 인식되도록 순서대로 지정해야한다는 점에 유의해야합니다. 다시 말하면 WebView 이후 버튼을 먼저 사용한 다음 WebView가 있어야합니다. 버튼을 참조합니다. 나는 이것이 1.6 또는 2.0에서 변경되었다고 생각하지만, 나는 긍정적이지 않다.

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

  <Button android:text="Ok" 
          android:id="@+id/btnOk" 
          android:layout_width="120px" 
          android:layout_height="wrap_content"
          android:layout_gravity="center_horizontal"
          android:layout_alignParentBottom="true"
          android:layout_centerHorizontal="true"/>
    <WebView android:id="@+id/webview"
           android:layout_above="@+id/btnOk"
           android:layout_width="fill_parent"
           android:layout_height="fill_parent"
           /> 
</RelativeLayout>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top