首頁 收藏 QQ群
 網(wǎng)站導(dǎo)航

ZNDS智能電視網(wǎng) 推薦當(dāng)貝市場

TV應(yīng)用下載 / 資源分享區(qū)

軟件下載 | 游戲 | 討論 | 電視計算器

綜合交流 / 評測 / 活動區(qū)

交流區(qū) | 測硬件 | 網(wǎng)站活動 | Z幣中心

新手入門 / 進階 / 社區(qū)互助

新手 | 你問我答 | 免費刷機救磚 | ROM固件

查看: 13569|回復(fù): 0
上一主題 下一主題
[教程]

Android 全面介紹EditText

[復(fù)制鏈接]
跳轉(zhuǎn)到指定樓層
樓主
發(fā)表于 2013-8-28 16:29 | 只看該作者 回帖獎勵 |倒序瀏覽 |閱讀模式
0EditText繼承關(guān)系:View-->TextView-->EditText。   
  EditText的屬性很多,這里介紹幾個:   
   
  android:layout_gravity="center_vertical"   
  設(shè)置控件顯示的位置:默認(rèn) top,這里居中顯示,還有bOTTom   
  android:hint="請輸入數(shù)字!"   
  設(shè)置顯示在空間上的提示信息   
  android:numeric="integer"   
  設(shè)置只能輸入整數(shù),如果是小數(shù)則是:decimal   
  android:singleLine="true"   
  設(shè)置單行輸入,一旦設(shè)置為true,則文字不會自動換行。   
  android:password="true"   
  設(shè)置只能輸入密碼   
  android:textColor = "#ff8c00"   
  字體顏色   
  android:textStyle="bold"   
  字體,bold, italic, bolditalic   
  android:textSize="20dip"   
  大小   
  android:capitalize = "characters"   
  以大寫字母寫   
  android:textAlign="center"   
  EditText沒有這個屬性,但TextView有,居中   
  android:textColorHighlight="#cccccc"   
  被選中文字的底色,默認(rèn)為藍(lán)色   
  android:textColorHint="#ffff00"   
  設(shè)置提示信息文字的顏色,默認(rèn)為灰色   
  android:textScaleX="1.5"   
  控制字與字之間的間距   
  android:typeface="monospace"   
  字型,normal, sans, serif, monospace   
  android:background="@null"   
  空間背景,這里沒有,指透明   
  android:layout_weight="1"   
  權(quán)重,控制控件之間的地位,在控制控件顯示的大小時蠻有用的。   
  android:textAppearance="?android:attr/textAppearanceLargeInverse"   
  EditText始終不彈出軟件鍵盤   
   
      
   
     
  在 AndroidMainfest.xml中選擇哪個activity,設(shè)置windowSoftInputMode屬性為adjustUnspecified|stateHidden   
   
   
  1.    
    < activity android:name=".Main"   
       
    android:label="@string/app_name"   
       
    android:windowSoftInputMode="adjustUnspecified|stateHidden"   
       
    android:configChanges="orientation|keyboardHidden">   
       
    < intent-filter>   
       
    < action android:name="android.intent.action.MAIN" />   
       
    < category android:name="android.intent.category.LAUNCHER" />   
       
    < /intent-filter>   
       
    < /activity>   
復(fù)制代碼
  讓 EditText失去焦點,使用EditText的clearFocus方法   
  例如:EditText edit=(EditText)findViewById(R.id.edit);   
  edit.clearFocus();   
   
     
  強制隱藏Android輸入法窗口   
  例如:EditText edit=(EditText)findViewById(R.id.edit);   
  InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);   
  imm.hideSoftInputFromWindow(edit.getWindowToken(),0);   
   
     
  例:EditText edit=(EditText)findViewById(R.id.edit);   
  edit.setInputType(InputType.TYPE_NULL);   
   

上一篇:android面試題
下一篇:如何在Eclipse中看Android2.2的源碼
您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規(guī)則

Archiver|新帖|標(biāo)簽|軟件|Sitemap|ZNDS智能電視網(wǎng) ( 蘇ICP備2023012627號 )

網(wǎng)絡(luò)信息服務(wù)信用承諾書 | 增值電信業(yè)務(wù)經(jīng)營許可證:蘇B2-20221768 丨 蘇公網(wǎng)安備 32011402011373號

GMT+8, 2024-10-19 16:27 , Processed in 0.053977 second(s), 15 queries , Redis On.

Powered by Discuz!

監(jiān)督舉報:report#znds.com (請將#替換為@)

© 2007-2024 ZNDS.Com

快速回復(fù) 返回頂部 返回列表