Android 编辑文本高度变化故障
我有Android 编辑文本高度变化故障,android,android-edittext,Android,Android Edittext,我有EditText,它可以动态地改变高度。所以我在编辑文本方面有问题。。文本已隐藏,请参见屏幕截图: 代码: 那么,我做错了什么 布局: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout
EditText
,它可以动态地改变高度。所以我在编辑文本方面有问题。。文本已隐藏,请参见屏幕截图:
代码:
那么,我做错了什么
布局:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/matcher_background"
android:orientation="vertical">
<com.***.ui.customviews.EditableTextView
android:id="@+id/editable_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
谢谢大家。我找到了这个问题的解决方案:
editText.setPadding(-5, -5, -5, -3);
谢谢。您是否在
measuredHeight=editText.getMeasuredHeight()中添加了断点代码>以检查实际高度?另外,为什么不尝试使用editText.getHeight()
?另外,请发布布局文件here@astinx是的,尺寸不是0。editText.getHeight()不使用,因为它返回0。@Nikmeyers xml已添加到问题正文中。为什么不更改文本大小?
editText.setPadding(-5, -5, -5, -3);