6

スイングのようにタイトル付きのボーダーレイアウトを作成する方法を誰かが考えていますか?

このサイトでオブジェクト間に長方形を生成するためのトリックを見つけました。たぶん、これは私がそのようなタイトルの付いた境界線を作成するのを助けることができますか?

あいさつ

4

1 に答える 1

6

速くて汚い:

<?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ドローアブル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>
于 2013-02-01T00:31:51.163 に答える