2016-12-07 60 views
0

how to put text in borderAndroid的附加文本

我如何能在Android的

添加文本越過邊境有些人認爲這樣的 Text in Border CSS HTML

+0

是對一些頂級的文本視圖其他視圖/沒什麼特別/ –

+0

[legend and fieldset in android]可能的重複(http://stackoverflow.com/questions/12155353/legend-and-fieldset-in-android) –

+0

你可以用WebView來實現這個任務 –

回答

0

您還可以在非道德way..its相當快捷的方式實現這一目標來實現這個....嘗試......

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="#ffffff" > 

    <EditText 
     android:id="@+id/edittext" 
     android:layout_width="fill_parent" 
     android:layout_height="90dp" 
     android:layout_alignLeft="@+id/button" 
     android:layout_below="@+id/textView1" 
     android:layout_marginTop="61dp" 
     android:background="@drawable/border" 
     android:ems="10" 
     android:inputType="text" 
     android:text="hia" /> 

    <Button 
     android:id="@+id/button1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentLeft="true" 
     android:layout_alignParentTop="true" 
     android:layout_marginLeft="20dp" 
     android:layout_marginTop="46dp" 
     android:background="#ffffff" 
     android:clickable="false" 
     android:text="vvvv" 
     android:textSize="24dp" /> 

</RelativeLayout> 
0

使用從HERE

複製裏面的佈置此佈局
<?xml version="1.0" encoding="utf-8"?> 
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     android:layout_width="fill_parent" android:layout_height="fill_parent" 
     android:background="@android:color/white"> 

     <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" 
      android:background="@android:color/white" android:padding="5dp" 
      android:text="Testing" 
      android:layout_marginLeft="30dp" android:textColor="@android:color/black" /> 

     <RelativeLayout 
      android:layout_width="fill_parent" android:layout_height="fill_parent" 
      android:background="@drawable/frame" 
      android:orientation="vertical" android:padding="20dp" 
      android:layout_centerVertical="true" 
      android:layout_centerHorizontal="true"> 

      <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" 
       android:text="Main Content" android:layout_centerInParent="true" /> 
     </RelativeLayout> 
    </RelativeLayout> 

創建一個frame.xml內部可繪製

<shape xmlns:android="schemas.android.com/apk/res/android"> 
<stroke android:width="1px" android:color="@color/black" /><padding android:left="1dp" 
android:top="1dp" 
android:right="1dp" 
android:bottom="1dp" /> 
</shape>