自动调整EditText和按钮的大小和位置
-
29-09-2019 - |
题
在仿真器中,Edittext和button的大小看起来不错,但是在摩托罗拉里程碑中,它们俩都很小。我认为有不同类型的屏幕布局。是否可以自动调整大小?我的XML如下:
<?xml version="1.0" encoding="utf-8"?><RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<EditText android:id="@+id/txtToText_e"
android:layout_width="270px"
android:layout_height="wrap_content"
android:textSize="18sp"
android:hint="Type To Compose"
android:layout_alignParentBottom = "true"
android:layout_alignParentLeft="true"/> <Button android:text="Send"
android:id="@+id/btnDone_e"
android:layout_width="85px"
android:layout_height="wrap_content"
android:layout_alignParentBottom = "true"
android:layout_alignParentRight="true"/>
要在将手机从肖像转换为风景时获得自动重新尺寸的递观,我将这些XML代码添加到AndroidManifest.xml中
<supports-screens android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:anyDensity="true" />
但是什么都没有变化= [。如何修复?
谢谢你。
解决方案
如果您希望根据屏幕密度更改尺寸,请使用 dip
对于尺寸而不是 px
.
不隶属于 StackOverflow