本文實例講述了Android實現跑馬燈效果的方法。分享給大家供大家參考。具體如下:
運行效果截圖如下:
直接在布局里寫代碼就好了:
<TextView android:id="@+id/menu_desc" android:layout_width="300dip" android:layout_height="wrap_content" android:text="溫馨提示:左右滑動更改菜單,點擊進入" android:textColor="@color/white" android:textSize="22dip" android:singleLine="true" android:ellipsize="marquee" android:focusable="true" android:focusableInTouchMode="true" android:scrollHorizontally="true" android:marqueeRepeatLimit="marquee_forever" android:layout_centerHorizontal="true" android:layout_centerVertical="true" ></TextView>
主要是這幾行:
android:singleLine="true"
android:ellipsize="marquee"
android:focusable="true"
android:focusableInTouchMode="true"
android:scrollHorizontally="true"
android:marqueeRepeatLimit="marquee_forever"
希望本文所述對大家的Android程序設計有所幫助。
新聞熱點
疑難解答
圖片精選