我试图插入一个文本字段或按钮到一个小的布局栏,但由于某种原因它没有显示。试图将文本字段添加到小布局?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#d1cbcb">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="#767eca">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text = "Ankosh"
android:textColor="#ffffff"
android:textSize="20sp"></TextView>
</RelativeLayout>
</LinearLayout>
什么不显示? –
为什么在背景后关闭relativeLayout?如果textview应该放在里面,那么不需要... – Opiatefuchs
提供方向 - 垂直或水平到线性布局。 如果你想为textview指定一些高度,最好将它提供给textview本身,而不是父级布局。 – Ankita