TextView与附近按钮的高度相同 [英] TextView same height as nearby button
本文介绍了TextView与附近按钮的高度相同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
列表项的布局:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<Button
android:id="@+id/removeButton"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_alignParentRight="true"
android:drawableRight="@drawable/ic_action_next_item"
android:gravity="center_horizontal">
</Button>
<TextView
android:id="@+id/list_item"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:layout_toLeftOf="@id/removeButton"
android:background="#e2e2e2"
android:gravity="center_vertical|left" />
</RelativeLayout>
如何使文本视图的高度与按钮高度相同?并且文本视图内的文本未居中.有任何想法如何将其居中吗?
How can I make the text view the same height as the button height? AND the text inside the text view is not centered. Any ideas how to center it?
推荐答案
将这些属性添加到textView
android:layout_alignBottom="@+id/removeButton"
android:layout_alignTop="@+id/removeButton"
android:gravity="center_vertical"
这篇关于TextView与附近按钮的高度相同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文