[img]http://dl.iteye.com/upload/attachment/452968/b0a0a8bb-361b-35ff-bd94-821376754b04.png[/img]
[b]
[size=medium]
注意:text1 text2 ... text7 text8中的...是表示text3 text 4直到text7,而不是真的...
[/size]
[/b]
[b]
[size=medium]
注意:text1 text2 ... text7 text8中的...是表示text3 text 4直到text7,而不是真的...
[/size]
[/b]
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#eee"
android:orientation="vertical"
>
<!--
scrollbar是表示要显示的滚动条;但对于TextView来说滚动条只是一个装饰,只是显示了,没实际功能
scrollHorizontally表示是否可以水平滚动,false的话就会换行
-->
<TextView
android:layout_width="fill_parent"
android:layout_height="40sp"
android:background="#000"
android:gravity="center"
android:text="horizontial scrollbar test: text1 text2 text3 ... text7 text8"
android:scrollHorizontally="true"
android:scrollbars="horizontal"
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="40sp"
android:layout_marginTop="1sp"
android:background="#000"
android:gravity="center"
android:text="vertical scrollbar test: text1 text2 text3 ... text7 text8 text9 text0"
android:scrollbars="vertical|horizontal"
android:textScaleX="1.8"
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="40sp"
android:layout_marginTop="1sp"
android:background="#000"
android:gravity="center_vertical"
android:text="ellipsize and singleLine: text1 text2 text3 ... text7 text8 text9 text0"
android:singleLine="true"
android:ellipsize="middle"
/>
<TextView
android:id="@+id/view"
android:layout_width="fill_parent"
android:layout_height="40sp"
android:layout_marginTop="1sp"
android:background="#000"
android:gravity="center_vertical"
android:text="ellipsize and line: text1 text2 text3 ... text7 text8 text9 text0"
android:minLines="1"
android:lines="1"
android:maxLines="1"
android:ellipsize="middle"
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="40sp"
android:layout_marginTop="1sp"
android:background="#000"
android:gravity="center_vertical"
android:text="singleline test: text1 text2 text3 ... text7 text8 text9 text0"
android:singleLine="true"
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="40sp"
android:layout_marginTop="1sp"
android:background="#000"
android:gravity="center_vertical"
android:text="length:8 10 13 16 19 22 25"
android:maxLength="20"
/>
<!--
这个是因为设置了layout_width, layout_height,后面的width, height的设置就没起效果
-->
<TextView
android:layout_width="fill_parent"
android:layout_height="40sp"
android:layout_marginTop="1sp"
android:background="#000"
android:gravity="center_vertical"
android:text="width and height: text1 text2 text3 ... text7 text8 text9 text0"
android:minWidth="10sp"
android:width="20sp"
android:maxWidth="30sp"
android:minHeight="5sp"
android:height="10sp"
android:maxHeight="15sp"
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="40sp"
android:layout_marginTop="1sp"
android:background="#000"
android:gravity="center_vertical"
android:text="text style test: text1 text2 text3 ... text7 text8 text9 text0"
android:textColor="#f00"
android:textStyle="bold"
android:typeface="sans"
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="40sp"
android:layout_marginTop="1sp"
android:background="#000"
android:gravity="center_vertical"
android:hint="hit text test: text1 text2 text3 text4"
android:textColorHint="#0f0"
android:typeface="monospace"
android:textColorHighlight="#00f"
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="40sp"
android:layout_marginTop="1sp"
android:background="#000"
android:gravity="center_vertical"
android:hint="link test: http://www.google.com.hk, google@gmail.com"
android:linksClickable="true"
android:autoLink="web|email"
/>
</LinearLayout>