【发布时间】:2016-03-03 23:02:45
【问题描述】:
我正在尝试制作一个应用,但是当我在不同设备上对其进行测试时,按钮的大小保持不变。我尝试使用具有等于 5dp 的填充的 Wrap_Content。代码如下:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#000">
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@ id/img2"
/>
<Button
android:layout_width="192dp"
android:layout_height="wrap_content"
android:id="@ id/button"
android:text="wallpaper"
android:alpha="0.1"
android:layout_gravity="left|bottom"
/>
<Button
android:layout_width="192dp"
android:layout_height="wrap_content"
android:text="back"
android:id="@ id/button2"
android:layout_gravity="right|bottom"
android:alpha="0.1" />
</FrameLayout>
我希望两个按钮都在底部中心相遇,但并非所有设备都符合预期。这是我设置 Match_Parent 时发生的情况
【问题讨论】:
-
你到底想要什么??
标签: android xml android-layout android-studio