아래의 RelativeLayout @ + id/saveCancelBar에서 view.setVisibility (View.VISIBLE)를 호출하면 FrameLayout의 일부를 덮습니다. FrameLayout을 RelativeLayout에 맞게 축소하고 싶습니다. 나는 SaveCancelBar을 보여주는 RelativeLayout의보다는있는 LinearLayout 모든 것을 넣으면 간단하게 위쪽으로 모두를 이동하고 화면다른 자식을 볼 때 RelativeLayout의 자식의 크기를 조정하는 방법은 무엇입니까?
당신은 두 가지를 수행해야합니다<RelativeLayout
android:id="@+id/content_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center|bottom">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/colorPrimary"
android:elevation="4dp"
android:layout_alignParentTop="true"
android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
<LinearLayout
android:id="@+id/content_view_panes"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/toolbar"
android:orientation="horizontal"
android:gravity="bottom">
<WebView
android:id="@+id/mainWebView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone" />
<FrameLayout
android:id="@+id/listContainer"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="@color/colorPrimaryDark"
android:layout_below="@+id/content_view_panes"
android:visibility="gone"
android:id="@+id/saveCancelBar">
<Button
android:id="@+id/editorCancelButton"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="@string/editor_cancel"
android:textColor="@color/white"
android:layout_alignParentLeft="true"
android:background="@color/colorPrimaryDark"/>
<Button
android:id="@+id/editorSaveButton"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="@string/editor_save"
android:textColor="@color/white"
android:layout_alignParentRight="true"
android:background="@color/colorPrimaryDark"/>
</RelativeLayout>
</RelativeLayout>
. 가시성을 설정할 때 중요합니까? onCreateView()에 있어야한다고 가정합니다. ID가 'content_view_panes'인 LinearLayout의 높이가 match_parent로 설정되는 것이 중요합니까? wrap_content를 사용하면 wrap_content 높이의 부모에게 WebView를 배치하는 것에 대한 오류가 발생합니다. – trpnd
실수로, LinearLayout'content_view_panes'가 가로 방향임을 알지 못했습니다. 답변을 업데이트하고 작동하고 테스트 된 코드를 추가했습니다. –