我创建了如下的GUI,使用了线性布局,并且给这个布局设置了边框。我想在这个边框上插入标题。如何实现啊?
设置一个 relative布局,然后在把所有的linear布局的代码添加在relative layout里。再添加textview,并且标明textview在top位置,同时给出外边距。
<RelativeLayout>
<TextView android:layout_alignParentTop="true"
android:layout_margin="20dip/>
<LinearLayout>
// here is your linear layout
</LinearLayout>
</RelativeLayout>
<RelativeLayout>)
<LinearLayout with border>
<TextView with white background>
</RelativeLayout>
TextView应该添加在linear布局上面,覆盖边框与布局的白色背景。你要使用外边距设置标题的位置。