Android 在线性布局周围以标题为边框
我想在这张图片上的Android 在线性布局周围以标题为边框,android,border,android-linearlayout,shape,Android,Border,Android Linearlayout,Shape,我想在这张图片上的LinearLayout周围画一个标题边框 我已经有边界了。 如何添加标题? 我通过在drawable文件夹中创建一个.xml文件来创建边框。在那里我做了一个形状,然后我将线性布局的背景设置为这个形状 我使用的是API Level 8。您可能想看看Android框架布局 可能会找到一个好的教程,或者您可能想阅读该开发工具。根据@Radu的回答,您可以看到一个示例: <?xml version="1.0" encoding="utf-8"?> <FrameLa
LinearLayout
周围画一个标题边框
我已经有边界了。如何添加标题? 我通过在drawable文件夹中创建一个
.xml
文件来创建边框。在那里我做了一个形状,然后我将线性布局的背景设置为这个形状
我使用的是API Level 8。您可能想看看Android框架布局
可能会找到一个好的教程,或者您可能想阅读该开发工具。根据@Radu的回答,您可以看到一个示例:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:color="#000000">
<View
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/rectangle"
android:layout_margin="20dp"
/>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:background="#000000"
android:layout_marginTop="10dp"
android:text="TITLE!"
android:textColor="#ffffff"/>
</RelativeLayout>
</FrameLayout>
@drawable/rectangle位于drawable rectangle.xml文件中,如下所示:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@android:color/transparent"/>
<stroke android:width="2dip" android:color="#ffffff"/>
</shape>
欢迎来到StackOverflow。我对你的问题进行了编辑,修正了一些语法错误,以提高可读性。我也让你的问题更加突出,所以你的问题很明显。