Android中的requestFocus怎么使用

這篇文章主要介紹了Android中的requestFocus怎么使用的相關(guān)知識,內(nèi)容詳細易懂,操作簡單快捷,具有一定借鑒價值,相信大家閱讀完這篇Android中的requestFocus怎么使用文章都會有所收獲,下面我們一起來看看吧。

撫寧網(wǎng)站建設(shè)公司創(chuàng)新互聯(lián)建站,撫寧網(wǎng)站設(shè)計制作,有大型網(wǎng)站制作公司豐富經(jīng)驗。已為撫寧上千余家提供企業(yè)網(wǎng)站建設(shè)服務(wù)。企業(yè)網(wǎng)站搭建\成都外貿(mào)網(wǎng)站建設(shè)公司要多少錢,請找那個售后服務(wù)好的撫寧做網(wǎng)站的公司定做!

requestFocus的使用

一句話概括:

<requestFocus />: 標簽用于指定屏幕內(nèi)的焦點View。

布局資源文件的根節(jié)點可以使用容器控件(如LinearLayout、FrameLayout等),也可以使用非容器控件(如:EditText、TextView等)。對于非容器控件,只能在非容器控件標簽中放<requestFocus />標簽,表示將當前控件設(shè)為焦點。如下代碼:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
  android:layout_width="match_parent" 
  android:layout_height="match_parent" 
  android:orientation="vertical" > 
 
  <Button 
    android:id="@+id/buttonRingtone" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:text="設(shè)置來電鈴聲" /> 
 
  <Button 
    android:id="@+id/buttonAlarm" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:text="設(shè)置鬧鐘鈴聲" /> 
 
  <Button 
    android:id="@+id/buttonNotification" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:text="設(shè)置通知鈴聲" /> 
 
  <EditText 
    android:id="@+id/text" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" > 
    <!-- 當前控件處于焦點狀態(tài) --> 
    <requestFocus /> 
  </EditText> 
</LinearLayout>

關(guān)于“Android中的requestFocus怎么使用”這篇文章的內(nèi)容就介紹到這里,感謝各位的閱讀!相信大家對“Android中的requestFocus怎么使用”知識都有一定的了解,大家如果還想學(xué)習(xí)更多知識,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道。

名稱欄目:Android中的requestFocus怎么使用
網(wǎng)頁地址:http://muchs.cn/article20/jpgsjo.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供品牌網(wǎng)站制作、域名注冊網(wǎng)站設(shè)計、網(wǎng)站策劃、軟件開發(fā)靜態(tài)網(wǎng)站

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

成都定制網(wǎng)站網(wǎng)頁設(shè)計