我有下面的布局,基本上显示“消息”作为气泡更纤细的内置“消息”。我只需要在右边显示一个箭头图像,该图像是显示的,但我需要它垂直居中。我试着在图片中添加“android:gravity="center_vertical"
”,但是没有效果。
有什么线索吗?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:id="@+id/wrapper"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#00DBE2ED" >
<RelativeLayout
android:id="@+id/wrapper2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#00DBE2ED" >
<EditText
android:id="@+id/comment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:editable="false"
android:layout_marginTop="5dip"
android:layout_marginRight="5dip"
android:layout_marginLeft="5dip"
android:background="@drawable/bubble_yellow"
android:paddingLeft="10dip"
android:text="Hello bubbles!"
android:textColor="@android:color/primary_text_light" />
<TextView
android:id="@+id/sender"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="0dip"
android:paddingLeft="5dip"
android:paddingRight="2dip"
android:text="Hello bubbles!"
android:textColor="#b9dcdcdc"
android:textSize="11sp"
android:layout_below="@+id/comment" />
<ImageView
android:id="@+id/aquaplayicon"
android:src="@drawable/aquaplayicon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="true"
android:onClick="onClickGirl"
android:layout_alignParentRight="true"
android:paddingRight="3dip"
android:gravity="center_vertical" />
</RelativeLayout>
</LinearLayout>
</LinearLayout>
发布于 2013-02-22 01:16:04
ImageView
属性不是用于布局的,因为它是一个LinearLayout
属性,而您的ImageView
在您的RelativeLayout
中。相反,请删除该行
android:gravity="center_vertical"
并添加下面这行
android:layout_centerVertical="true"
发布于 2013-02-22 01:14:39
您要查找的属性是android:layout_centerVertical="true"
https://stackoverflow.com/questions/15008275
复制相似问题