编辑文本大小不应改变图像视图的大小
Edit text size should not alter the size of Image-view
我有一个Image-view
,下面有一个Edit text
在Relative-layout
。
当Edit-text
的大小因输入任意几行文本而增加时,
Image-view
的大小正在减少。
我想要的是我的文字应该重叠在 Image-view
而不是!改变它的大小。
请提出任何建议。
注意:我限制了我的编辑文本高度和可缩放。
代码如下:
<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 也会调整大小。
尝试删除此属性。
我有一个Image-view
,下面有一个Edit text
在Relative-layout
。
当Edit-text
的大小因输入任意几行文本而增加时,
Image-view
的大小正在减少。
我想要的是我的文字应该重叠在 Image-view
而不是!改变它的大小。
请提出任何建议。
注意:我限制了我的编辑文本高度和可缩放。
代码如下:
<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 也会调整大小。
尝试删除此属性。