[英]android layout issue with framelayout
我正在尝试添加图像视图,但是当我这样做时,图像的顶部和底部之间有很大的空间。 我正在使用带有片段的底部导航。 我想使图像尽可能靠近顶部。 这种布局我在做什么错?
主要活动
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:design="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.android.gershpark.MainActivity">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/main_image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:contentDescription="main image"
android:src="@drawable/fb_img_1497698892826" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/frame_layout"
android:layout_below="@id/main_image"
/>
<View
android:id="@+id/view"
android:layout_width="match_parent"
android:layout_height="8dp"
android:background="@drawable/shadow"
android:layout_above="@+id/bot_nav">
</View>
<android.support.design.widget.BottomNavigationView
android:id="@+id/bot_nav"
android:layout_gravity="bottom"
android:layout_width="match_parent"
android:layout_alignParentBottom="true"
android:layout_height="wrap_content"
android:background="@android:color/holo_blue_light"
design:itemIconTint='#f8f8f8'
design:menu='@menu/bot_menu'
/>
</RelativeLayout>
</android.support.design.widget.CoordinatorLayout>
家庭片段
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.android.gershpark.HomeFragment">
<!-- TODO: Update blank fragment layout -->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Home"/>
</FrameLayout>
看起来像通过添加以下内容删除了原来的间距。
android:adjustViewBounds =“ true”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.