【发布时间】:2016-11-15 13:17:35
【问题描述】:
我在MarshMallow 设备上进行了测试。当我为EditText 编写xml 并将PaddingBottom 设置为Retype EditText 时。但它不工作。但是当我将PaddingLeft 设置为New PassWord EditText 工作正常。
方法:1
xml代码:
<EditText
android:id="@+id/change_password_old_password_edittext"
android:layout_below="@+id/change_password_mobileNumber_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Old Password"
android:layout_marginTop="20.0dip"
android:textColorHint="#40000000"
android:textSize="@dimen/textsize16"/>
<EditText
android:id="@+id/change_password_new_password_edittext"
android:layout_below="@+id/change_password_old_password_edittext"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="New Password"
android:layout_marginTop="20.0dip"
android:textColorHint="#40000000"
android:paddingLeft="10dip"
android:textSize="@dimen/textsize16"/>
<EditText
android:id="@+id/change_password_retype_password_edittext"
android:layout_below="@+id/change_password_new_password_edittext"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Retype Password"
android:layout_marginTop="20.0dip"
android:paddingBottom="10dip"
android:textColorHint="#40000000"
android:textSize="@dimen/textsize16"/>
屏幕截图:
方法:2
然后我决定以编程方式设置PaddingBottom。但它给出了奇怪的输出。
java代码:
在OnCreate方法内
EditText change_password_retype_password_edittext = (EditText)findViewById(R.id.change_password_retype_password_edittext);
change_password_retype_password_edittext.setPadding(0,0,0,10);
输出:
注意:我已经在
Marshmallow、LolliPop和Jellybean上进行了测试。但在所有设备不工作。
【问题讨论】:
-
布局好像没问题。发布整个布局代码。
-
@AkshayBhat 你看到屏幕截图了吗?问题是显示..
-
是的,但是我复制了你的布局代码并尝试过,它工作正常
-
@AkshayBhat 发布屏幕截图..
标签: android xml android-layout android-studio android-edittext