我的第一个 textView 下方有一个 imageView,该图像下方有一个 textView。所以我想重新调整 imageView 的大小以使其高度更小,这样它就不会占据超过一半的屏幕。但是到目前为止,当我尝试将高度更改为 wrap_content 或 match_parent 时,它仍然是相同的大小。我也尝试设置最大高度,但似乎没有做任何事情。
我的 xml 文件:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/bg_gblue" >
<TextView
android:id="@+id/faq_story1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/faqpt1"
android:textSize="15sp" />
<ImageView
android:id="@+id/faq_pic1"
android:src="@drawable/skull"
android:layout_width="wrap_content"
android:layout_height="5dp"
android:maxHeight="10dp"
android:layout_above="@+id/faq_story2"
android:layout_below="@+id/faq_story1"
/>
<TextView
android:id="@+id/faq_story2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:text="@string/faqpt2"/>"
</RelativeLayout>
谢谢。
最佳答案
试试看,
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:id="@+id/faq_story1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/faqpt1"
android:textSize="15sp" />
<TextView
android:id="@+id/faq_story2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:text="@string/faqpt2" />
<ImageView
android:id="@+id/faq_pic1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/faq_story2"
android:layout_alignParentLeft="true"
android:src="@drawable/skull"
android:layout_below="@+id/faq_story1" />
</RelativeLayout>
关于android - 改变ImageView的高度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22807821/