我有一个 ImageView
,下面有一个相对布局
中的编辑文本
。
当Edit-text
的大小因输入任意几行文本而增加时,
ImageView
的大小正在减小。
我想要的是我的文本应该重叠在 ImageView
上而不是!改变其大小。
请提出任何建议。
注意:我限制了编辑文本的高度和可滚动性。
这是代码:
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:padding="5dp"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.myappp.custom_ui.RoundedImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff"
android:id="@+id/selected_attachment"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:layout_above="@+id/caption_holder"
app:riv_corner_radius="8dp" />
<RelativeLayout
android:layout_width="match_parent"
android:id="@+id/caption_holder"
android:background="@drawable/rounded_layout"
android:layout_alignParentBottom="true"
android:layout_height="wrap_content">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:capitalize="sentences"
android:layout_centerVertical="true"
android:layout_toLeftOf="@+id/send_attachement"
android:background="@android:color/transparent"
android:id="@+id/add_captionon_et"
android:hint="Add caption"
android:scrollbars="vertical"
android:maxLines="3"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="24sp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:padding="10dp"
android:id="@+id/send_attachement"
android:textColor="@color/myapp_theme_color"/>
</RelativeLayout>
最佳答案
问题出在使用android:layout_above="@+id/caption_holder"
。它说 ImageView 位于 Caption_holder 之上,因此当 Caption_holder 调整大小时,ImageView 也会调整大小。
尝试删除此属性。
关于android - 编辑文本大小不应改变 ImageView 的大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31585036/