Textview attribute settings
Android: layout_width ="Fill_parent" Android: layout_height ="Wrap_content" Android: Id ="@ + ID/autotx" |
Note: The parameter of the settext () or settextcolor () method is an int value or a resource address.
Android: autolink
<? 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: Orientation ="Vertical">
<Textview
Android: layout_width ="Fill_parent"
Android: layout_height ="Wrap_content"
Android: autolink ="Web"
Android: text ="@ String/weburl"
/>
<Textview
Android: layout_width ="Fill_parent"
Android: layout_height ="Wrap_content"
Android: autolink ="Email"
Android: text ="@ String/email"
/>
<Textview
Android: layout_width ="Fill_parent"
Android: layout_height ="Wrap_content"
Android: autolink ="Phone"
Android: text ="@ String/phonenumber"
/>
<Textview
Android: layout_width ="Fill_parent"
Android: layout_height ="Wrap_content"
Android: autolink ="Map"
Android: text ="@ String/mapurl"
/>
<Textview
Android: layout_width ="Fill_parent"
Android: layout_height ="Wrap_content"
Android: autolink ="Map"
Android: text ="@ String/mapurl"
Android: Id ="@ + ID/tvhtml"
/>
</Linearlayout>
Textview with border
Custom textview with border
PackageCN. class3g. activity; ImportAndroid. content. context; ImportAndroid. Graphics. Canvas; ImportAndroid. Graphics. paint; ImportAndroid. util. attributeset; ImportAndroid. widget. textview; Public classBordertextviewExtendsTextview { PublicBordertextview (context, attributeset ATTR ){ Super(Context, ATTR ); } Public voidOndraw (canvas ){ Super. Ondraw (canvas ); Paint paint =NewPaint (); Paint. setcolor (Android. Graphics. color.Green); Canvas. drawline (0, 0,This. Getwidth ()-1, 0, paint ); Canvas. drawline (0, 0, 0,This. Getheight ()-1, paint ); Canvas. drawline (This. Getwidth ()-1, 0, This. Getwidth ()-1, This. Getheight ()-1, paint ); Canvas. drawline (0,This. Getheight ()-1, This. Getwidth ()-1, This. Getheight ()-1, paint ); } } |
<CN. class3g. activity. bordertextview Android: layout_width ="Wrap_content" Android: layout_height ="Wrap_content" Android: gravity ="Center" Android: padding ="30dp" Android: text ="Xxxxxxxxxxxxx" /> |