這篇文章將為大家詳細(xì)講解有關(guān)怎么在Android應(yīng)用中利用textview實(shí)現(xiàn)一個(gè)長按復(fù)制功能,文章內(nèi)容質(zhì)量較高,因此小編分享給大家做個(gè)參考,希望大家閱讀完這篇文章后對(duì)相關(guān)知識(shí)有一定的了解。
這里有一個(gè)大坑,我的viewGroup中有一個(gè)這個(gè)屬性android:descendantFocusability=”blocksDescendants”
開始沒有注意到,試了好多方法都不行,后來才看到這個(gè)屬性,順便科普一下,這個(gè)屬性有三個(gè)值~
beforeDescendants:viewgroup會(huì)優(yōu)先其子類控件而獲取到焦點(diǎn)
afterDescendants:viewgroup只有當(dāng)其子類控件不需要獲取焦點(diǎn)時(shí)才獲取焦點(diǎn)
blocksDescendants:viewgroup會(huì)覆蓋子類控件而直接獲得焦點(diǎn)
這里使用afterDescendants就好了,
標(biāo)題有一點(diǎn)誤區(qū),其實(shí)這里的textView是editText,只是樣子像textView而已,直接上代碼
<EditText android:id="@+id/order_details_tv_order_number" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="2" android:background="@null" android:editable="false" android:textIsSelectable="true" android:gravity="right|center_vertical" android:lines="1" android:textColor="@color/pub_color_black" android:textCursorDrawable="@null" android:textSize="@dimen/text_h26" tools:text="2382787482347" />
新聞標(biāo)題:怎么在Android應(yīng)用中利用textview實(shí)現(xiàn)一個(gè)長按復(fù)制功能-創(chuàng)新互聯(lián)
當(dāng)前地址:http://aaarwkj.com/article24/dohije.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供軟件開發(fā)、小程序開發(fā)、響應(yīng)式網(wǎng)站、App開發(fā)、Google、網(wǎng)站維護(hù)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容