在我的XML文件中,我正在使用这个。我的问题是,为什么在较小的屏幕上使用它时,屏幕顶部和图像之间会有如此大的差距。在巨大的屏幕上,一切都很好。
编辑:我认为问题是因为重量。有什么想法吗?
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<ImageView
android:id="@+id/area"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:layout_weight="1"
android:src="@drawable/area_selector"
android:contentDescription="@string/app_name"/>
<ImageView
android:id="@+id/volume"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:layout_weight="1"
android:src="@drawable/volume_selector"
android:contentDescription="@string/app_name"/>
</LinearLayout>
代表Teovalds,注释的答案作为答案:尝试向图像视图标记添加android:adjustViewBounds="true"
。
此外,可以删除添加的magintop = 10 dp以最小化间隙!