導航:首頁 > 操作系統 > androidspinner輸入

androidspinner輸入

發布時間:2023-02-27 02:55:26

A. android spinner怎麼用

android中的spinner控制項是表示下拉菜單的意思,按照如下步驟使用:

1、首先使用Android studio創建一個項目,如下圖:

4、最後去類中綁定控制項,並添加數據即可使用。

B. Android 開發 Spinner變化的問題 具體看補充。

ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.select_dialog_item, arrList);
sp.setAdapter(adapter);
使用上面的方法顯示列表,你將「打游戲」添加到arrList數組中再刷新就可以了。。。
你現在是將Spinner中數據寫在arrays.xml中了吧、、、

C. android spinner的用法請教

可以用ArrayAdapter實現。
給你你個思路吧:

List<ShangPin> spList=new ArrayList<ShangPin>(); //商品類中有兩個屬性 :物品的名稱,物 品的url;
List<String> data=new ArrayList<String>(); //這個List用來裝 物品的名稱

for (int i = 0; i < spList.size(); i++) {
data.add(spList.get(i).getSpName()); //getSpName() 物品的名稱的get方法
}
sp.setAdapter(new ArrayAdapter<String>(RegisterActivity.this, android.R.layout.simple_spinner_item, data)); //設置Adapter

//設置監聽事件
sp_sheng.setOnItemSelectedListener(new OnItemSelectedListener() {

@Override
public void onItemSelected(AdapterView<?> parent,
View view, int position, long id) {

TextView tv=(TextView) view; //這里的view是TextView類型的 , 自己可以打出來看看
for (int i = 0; i < spList.size(); i++) { //循環商品類的List
if(spList.get(i).getSpName().equals(tv.getText())){ //判斷選中項在List中對應的商品類
String uri= result.get(i).getUri(); //這樣就可以拿到Uri了
}

。。。。。。 拿到了Uri那就做自己想做的事去吧

閱讀全文

與androidspinner輸入相關的資料

熱點內容
資料庫查詢系統源碼 瀏覽:617
php5314 瀏覽:358
完美國際安裝到哪個文件夾 瀏覽:668
什麼app可以掃一掃做題 瀏覽:539
程序員編碼論壇 瀏覽:923
淘點是什麼app 瀏覽:660
中國高等植物pdf 瀏覽:453
51單片機時間 瀏覽:182
後台如何獲取伺服器ip 瀏覽:267
單片機流水燈程序c語言 瀏覽:235
程序員第二職業掙錢 瀏覽:239
運行里怎麼輸入伺服器路徑 瀏覽:841
pythonstepwise 瀏覽:509
劉一男詞彙速記指南pdf 瀏覽:64
php認證級別 瀏覽:368
方舟編譯啥時候推送 瀏覽:1011
php手機驗證碼生成 瀏覽:676
哲學思維pdf 瀏覽:15
凌達壓縮機有限公司招聘 瀏覽:534
weblogic命令部署 瀏覽:38