【发布时间】:2016-05-26 13:11:27
【问题描述】:
两个相对布局之间存在间隙。我想消除这个差距。
我的图片的xml如下
<RelativeLayout
android:id="@+id/live_view_surface_view_rl"
android:layout_width="fill_parent"
android:layout_height="@dimen/video_height">
<RelativeLayout
android:id="@+id/surfaceview_rl"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:layout_above="@+id/palette_rl">
<SurfaceView
android:id="@+id/surfaceview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
android:layout_centerInParent="true">
</SurfaceView>
</RelativeLayout>
<RelativeLayout
android:id="@+id/palette_rl"
android:layout_width="fill_parent"
android:layout_height="60dp"
android:layout_alignParentBottom="true"
android:background="@color/transperent_black_color">
<RelativeLayout
android:id="@+id/snapshot_button_rl"
android:layout_width="50dp"
android:layout_height="fill_parent"
android:layout_marginLeft="@dimen/margin_left_right">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:src="@drawable/snapshotselection" />
</RelativeLayout>
<LinearLayout
android:id="@+id/mic_btn_rl_parent"
android:layout_width="100dp"
android:layout_height="fill_parent"
android:layout_toRightOf="@+id/snapshot_button_rl"
android:orientation="horizontal">
<RelativeLayout
android:id="@+id/mic_button_rl"
android:layout_width="50dp"
android:layout_height="fill_parent">
<ImageView
android:id="@+id/mic_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:src="@drawable/talkbackbtn_selector" />
<ProgressBar
android:id="@+id/start_talkback_progress"
android:layout_width="@dimen/field_width_small"
android:layout_height="@dimen/field_width_small"
android:layout_centerInParent="true"
android:visibility="gone" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/live_view_audio_icon_rl"
android:layout_width="@dimen/field_width_medium"
android:layout_height="fill_parent">
<ImageView
android:id="@+id/live_view_audio_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:src="@drawable/icon_volume" />
</RelativeLayout>
</LinearLayout>
</RelativeLayout>
</RelativeLayout>
即使我增加了下面相对布局的高度,这个间隙也保持不变。 两种布局都有相同的父级,但它们仍然没有调整到相同的位置。
【问题讨论】:
-
请发布您的 xml
-
@Nisarg 这是我的 xml
-
现在让我检查一下
-
这是给定身高的空间 android:layout_height="60dp" 请避免硬编码
-
@AditayKaushal 你能建议我改用什么吗?
标签: android xml android-relativelayout