Basic4Android中ListView組建的示範

來源:互聯網
上載者:User

標籤:des   android   class   blog   code   http   

#Region  Project Attributes #ApplicationLabel: ListViewTest#VersionCode: 20140625#VersionName: ‘SupportedOrientations possible values: unspecified, landscape or portrait.#SupportedOrientations: unspecified#CanInstallToExternalStorage: False#End Region#Region  Activity Attributes #FullScreen: False#IncludeTitle: True#End RegionSub Process_Globals‘These global variables will be declared once when the application starts.‘These variables can be accessed from all modules.‘ 本工程修改於《basic4android 開發教程翻譯(八)使用ListView 》End SubSub Globals‘These global variables will be redeclared each time the activity is created.‘These variables can only be accessed from this module.Private lvwBrowser As ListView ‘ 聲明組件End SubSub Activity_Create(FirstTime As Boolean)‘Do not forget to load the layout file created with the visual designer. For example:Activity.LoadLayout("1")Dim gd As GradientDrawable ‘ 漸層效果類,GradientDrawable 支援使用漸層色來繪製圖形gd.Initialize("TOP_BOTTOM", Array As Int(Colors.Black , Colors.LightGray))‘第一個參數定義漸層的方向,有下列值供選擇‘"TOP_BOTTOM" "頂部->底部" ‘"TR_BL" (Top-Right To Bottom-Left) (右上->左下) ‘"RIGHT_LEFT" "右->左" ‘"BR_TL" (Bottom-Right To Top-Left) "BR_TL" (左下->右上) ‘"BOTTOM_TOP" "底部->頂部" ‘"BL_TR" (Bottom-Left To Top-Right) "BL_TR" (左下->右上) ‘"LEFT_RIGHT" "左->右" ‘"TL_BR" (Top-Left To Bottom-Right) (左上->到右下)Activity.Background = gd ‘ Activity表單背景使用漸層色效果lvwBrowser.Width =100%xlvwBrowser.ScrollingBackgroundColor = Colors.Transparent ‘ 縱向捲軸背景色=透明lvwBrowser.Initialize ("lvwBrowser")lvwBrowser.SingleLineLayout.Label.TextSize =20 ‘ 字型大小lvwBrowser.SingleLineLayout.Label.TextColor = Colors.Green ‘ 字型顏色 lvwBrowser.SingleLineLayout.Label.Gravity =Gravity.LEFT ‘ 字型顯示位置lvwBrowser.SingleLineLayout.ItemHeight = 60dip ‘ 行高度lvwBrowser.TwoLinesLayout.Label.TextSize =20 ‘ 字型大小lvwBrowser.TwoLinesLayout.Label.TextColor =Colors.Yellow ‘ 字型顏色lvwBrowser.TwoLinesLayout.SecondLabel.TextSize =20 ‘ 字型大小lvwBrowser.TwoLinesLayout.SecondLabel.TextColor =Colors.Red ‘ 字型顏色lvwBrowser.FastScrollEnabled = True ‘ 快速滾動器Dim BitmapIcon As BitmapBitmapIcon.Initialize(File.DirAssets, "1.png")Dim i As Int For i=1 To 20lvwBrowser.AddSingleLine("單行項(AddSingleLine) " & i)lvwBrowser.AddTwoLines ("文本雙行項(AddTwoLines)" & i," —— 第二行Text —— " & i)lvwBrowser.AddTwoLinesAndBitmap("圖形雙行項" & i, " —— 第二行Text —— " & i,BitmapIcon)NextActivity.AddView(lvwBrowser, 0, 0, 100%x, 100%y)End SubSub Activity_ResumeEnd SubSub Activity_Pause (UserClosed As Boolean)End SubSub lvwBrowser_ItemClick (Position As Int, Value As Object)‘ 參數 Position 是清單項目索引‘ 參數 Value  是清單項目文本Activity.Title = "( " & Position & " )" & "-" & ValueEnd Sub

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.