【发布时间】:2019-07-05 21:42:56
【问题描述】:
我想知道,仍然找不到这个问题。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:background="@color/colorPrimary"
android:layout_width="match_parent"
android:layout_height="48dp"/>
<ImageView
android:src="@drawable/someImage"
android:id="@+id/kioskModeImageView"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>
对于上述结构,我的 ImageView 两侧被缩短,左右两边有一些奇怪的边距,我不知道它们是从哪里来的。
当我从容器中的 LinearLayout 中删除 FrameLayout(并且仅将 ImageView 作为一件事)时,一切都按预期工作 - 图像占据了整个位置,因为 match_parent 应该可以工作
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:src="@drawable/customer_dark_1"
android:id="@+id/kioskModeImageView"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>
是什么导致了这个问题?
【问题讨论】:
标签: android android-layout android-linearlayout android-imageview