高煥堂Android應用架構原理與程式設計代碼補遺(一)

來源:互聯網
上載者:User

相信很多沒有做過移動開發的朋友和我一樣從高煥堂老師的這本書開始Android入門,但是看到第5計以及後面的幾計發現照著敲代碼總是有問題,因為沒有simple_list_item_1,後面的代碼解釋貌似也沒有提到這個檔案是什麼其實這個xml檔案現在看來就像是Flex中的ItemRenderer或者asp.net中ItemTemplate的意思,內容只是如下的內容

<?xml version="1.0" encoding="UTF-8"?>
<TextView android:text="TextView01" android:id="@+id/TextView01"
android:layout_width="fill_parent" android:layout_height="wrap_content"
xmlns:android="http://schemas.android.com/apk/res/android"></TextView>

 

adapter = new ArrayAdapter<String>
(this, android.R.layout.simple_list_item_1, dm.loadData());

這句話就是把資料用simple_list_item_1來渲染資料,
lv.setAdapter(adapter);

把資料顯示在listview上

貌似Android中的Adapter是設定渲染與資料繫結的工具,然後再將渲染和資料與容器綁定。

ps:貌似現在應用程式介面設計模式都趨向於xml了,Flex,Silverlight,WPF,Android都是使用XML布局,只要搞懂術語間的對應似乎方法都出不多。

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.