欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久

打開(kāi)APP
userphoto
未登錄

開(kāi)通VIP,暢享免費電子書(shū)等14項超值服

開(kāi)通VIP
addStatesFromChildren 和跑馬燈 - java - JavaEye技術(shù)網(wǎng)站

在A(yíng)ndroid中要顯示跑馬燈是比較容易的,只要設置2個(gè)屬性就可以了:
android:singleLine="true"
android:ellipsize="marquee"

但是要顯示跑馬燈該View必需是可以取得焦點(diǎn)的,只有在取得焦點(diǎn)的情況下跑馬燈才會(huì )出現.
如果是組合View的情況下就有問(wèn)題了,如下一個(gè)組合View:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:orientation="vertical"
  android:gravity="center_vertical"
  android:background="@drawable/f_background"
  android:layout_width="fill_parent"
  android:focusable="true"
  android:layout_height="50px">
  <TextView 
      android:id="@+id/info_text"
      android:focusable="true"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:text="test marquee 
.. "
      android:textColor="@color/black"
      android:singleLine="true"
      android:ellipsize="marquee"
      android:marqueeRepeatLimit="3"
      android:textSize="18sp"
  />
  <TextView 
      android:id="@+id/date_text"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:layout_gravity="bottom"
      android:textColor="@color/gray"
      android:text="2010/05/28"
      android:textSize="12sp"
  />
</LinearLayout>


上面示例中2個(gè)TextView組合為一個(gè)View,由于設置了LinearLayout為focusable而TextView就沒(méi)法取得焦點(diǎn)了,這樣這個(gè)TextView的跑馬燈效果就顯示不出來(lái),就算你也設置TextView的 android:focusable="true" 也是沒(méi)用的. 這個(gè)時(shí)候就要使用addStatesFromChildren 這個(gè)屬性了,在LinearLayout中設置這個(gè)屬性,然后設置TextView的focusable="true"就可以了.關(guān)于addStatesFromChildren的說(shuō)明:

Setswhether thisViewGroup's drawablestates also include its children's drawablestates.

可以正常顯示的代碼:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:orientation="vertical"
  android:gravity="center_vertical"
  android:background="@drawable/zixun_background"
  android:layout_width="fill_parent"
  android:addStatesFromChildren="true"
  android:layout_height="50px">
  <TextView 
      android:id="@+id/info_text"
      android:focusable="true"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:text=" "
      android:textColor="@color/black"
      android:singleLine="true"
      android:ellipsize="marquee"
      android:marqueeRepeatLimit="3"
      android:textSize="18sp"
  />
  <TextView 
      android:id="@+id/date_text"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:layout_gravity="bottom"
      android:textColor="@color/gray"
      android:text="2010/05/28"
      android:textSize="12sp"
  />
</LinearLayout>

本站僅提供存儲服務(wù),所有內容均由用戶(hù)發(fā)布,如發(fā)現有害或侵權內容,請點(diǎn)擊舉報。
打開(kāi)APP,閱讀全文并永久保存 查看更多類(lèi)似文章
猜你喜歡
類(lèi)似文章
EditText的初始Focus如何消除
AndroidUI優(yōu)化4
自定義PopupWindow動(dòng)畫(huà)效果
/******textview滾動(dòng)條效果的text***/
android中關(guān)于scrollview內部組件android:layout
Android 設置頁(yè)面UI設計
更多類(lèi)似文章 >>
生活服務(wù)
分享 收藏 導長(cháng)圖 關(guān)注 下載文章
綁定賬號成功
后續可登錄賬號暢享VIP特權!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服

欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久