当前位置: 首页 > news >正文

山西做网站建设的平台哪个推广网站好

山西做网站建设的平台,哪个推广网站好,做微商怎么样引流人脉,php 社交网站模板源码Android ListView 是垂直滚动列表中显示的视图,使用 Adapter 从列表(如数组或数据库)中获取内容的列表项会自动插入列表中。 适配器(Adapter)实际上是UI组件和将数据填充到UI组件中的数据源之间的桥梁,适配器保存数据并将数据发送到适配器视图&#xff0…

Android ListView 是垂直滚动列表中显示的视图,使用 Adapter 从列表(如数组或数据库)中获取内容的列表项会自动插入列表中。

List View

适配器(Adapter)实际上是UI组件和将数据填充到UI组件中的数据源之间的桥梁,适配器保存数据并将数据发送到适配器视图,该视图可以从适配器视图获取数据,并在不同的视图上显示数据。

ListView 和 GridView 是 AdapterView 的子类,可以通过将它们绑定到 Adapter 来填充它们,该适配器检索来自外部源的数据,并创建一个表示每个数据条目的视图。

Android提供了Adapter的多个子类,这些子类可用于检索各种类型的数据并为AdapterView构建视图(即ListView或GridView)。常见的适配器是ArrayAdapter,Base Adapter,CursorAdapter,SimpleCursorAdapter,SpinnerAdapter和WrapperListAdapter。

List View - 属性

以下是特定于GridView的重要属性-

Sr.NoAttribute & 描述
1

android:id

这是唯一标识布局的ID。

2

android:divider

这是可绘制的或可在列表项之间绘制的颜色。

3

android:dividerHeight

这指定分隔线的高度。可以是px,dp,sp,in或mm。

4

android:entries

指定对将填充ListView的数组资源的引用。

5

android:footerDividersEnabled

当设置为false时,ListView将不会在每个页脚视图之前绘制分隔线。默认值是true。

6

android:headerDividersEnabled

设置为false时,ListView不会在每个标题视图之后绘制分隔线。默认值是true。

ArrayAdapter

当您的数据源是数组时,可以使用此适配器。默认情况下,ArrayAdapter通过在每个项目上调用toString()并将其内容放置在TextView中,为每个数组项目创建一个视图。假设您有一个要在ListView中显示的字符串数组,请使用构造函数初始化一个新的ArrayAdapter,以指定每个字符串和字符串数组的布局-

ArrayAdapter adapter = new ArrayAdapter<String>(this,R.layout.ListView,StringArray);

这是此构造函数的参数-

  • 第一个参数 this 是应用程序context上下文,在大多数情况下,请将其保留为 this 。

  • 第二个参数将在XML文件中进行布局定义,并为数组中的每个字符串 TextView组件 。

  • 最终参数是将在文本视图中填充的字符串数组。

创建数组适配器后,只需在 ListView 对象上调用 setAdapter(),如下所示-

ListView listView = (ListView) findViewById(R.id.listview);
listView.setAdapter(adapter);

您将在XML文件的res/layout目录下定义列表视图。对于无涯教程的示例,无涯教程将使用activity_main.xml文件。

ArrayAdapter - 示例

下面的示例将引导您完成简单的步骤,以展示如何使用ListView创建自己的Android应用程序。

以下是修改后的主要Activity文件 src/com.example.ListDisplay/ListDisplay.java 的内容。

package com.example.ListDisplay;import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.widget.ArrayAdapter;
import android.widget.ListView;public class ListDisplay extends Activity {// Array of strings...String[] mobileArray = {"Android","IPhone","WindowsMobile","Blackberry","WebOS","Ubuntu","Windows7","Max OS X"};@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);ArrayAdapter adapter = new ArrayAdapter<String>(this, R.layout.activity_listview, mobileArray);ListView listView = (ListView) findViewById(R.id.mobile_list);listView.setAdapter(adapter);}
}

以下是 res/layout/activity_main.xml 文件的内容-

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"xmlns:tools="http://schemas.android.com/tools"android:layout_width="match_parent"android:layout_height="match_parent"android:orientation="vertical"tools:context=".ListActivity" ><ListViewandroid:id="@+id/mobile_list"android:layout_width="match_parent"android:layout_height="wrap_content" ></ListView></LinearLayout>

以下是 res/values/strings.xml 的内容,以定义两个新的常量-

<?xml version="1.0" encoding="utf-8"?>
<resources><string name="app_name">ListDisplay</string><string name="action_settings">Settings</string>
</resources>

以下是 res/layout/activity_listview.xml 文件的内容-

<?xml version="1.0" encoding="utf-8"?>
<!--  Single List Item Design --><TextView xmlns:android="http://schemas.android.com/apk/res/android"android:id="@+id/label"android:layout_width="fill_parent"android:layout_height="fill_parent"android:padding="10dip"android:textSize="16dip"android:textStyle="bold" >
</TextView>

单击"运行Eclipse运行图标工具栏。 Android studio将应用程序安装在您的AVD上并启动它,如果设置和应用程序一切正常,它将在"Emulator"窗口中显示-

List View

SimpleCursorAdapter

当您的数据源是数据库Cursor时,可以使用此适配器,使用 SimpleCursorAdapter 时,必须指定用于 Cursor 中每一行的布局,以及Cursor中的获取哪些值显示。

如果要获取创建人员姓名和电话列表,则可以执行查询,该查询返回一个Cursor,其中包含每个人的一行以及姓名和电话列。然后,您创建一个字符串数组,该字符串数组为实图填充数据

String[] fromColumns = {ContactsContract.Data.DISPLAY_NAME, ContactsContract.CommonDataKinds.Phone.NUMBER};
int[] toViews = {R.id.display_name, R.id.phone_number};

实例化SimpleCursorAdapter时,传递用于每个输出的布局,包含输出的Cursor以及这两个数组-

SimpleCursorAdapter adapter = new SimpleCursorAdapter(this, R.layout.person_name_and_number, cursor, fromColumns, toViews, 0);ListView listView = getListView();
listView.setAdapter(adapter);

然后,SimpleCursorAdapter使用所提供的布局为Cursor中的每一行创建一个视图,方法是将" from Columns"项插入相应的 toViews 视图。

Android 中的 List View函数 - 无涯教程网无涯教程网提供Android ListView 是垂直滚动列表中显示的视图,使用 Adapter 从列表(如数组或数据库)...https://www.learnfk.com/android/android-list-view.html


文章转载自:
http://chevalier.rdgb.cn
http://spinsterish.rdgb.cn
http://arrestee.rdgb.cn
http://hoise.rdgb.cn
http://vax.rdgb.cn
http://employee.rdgb.cn
http://screenwiper.rdgb.cn
http://wreckage.rdgb.cn
http://sabbatarianism.rdgb.cn
http://quadriennium.rdgb.cn
http://abstracted.rdgb.cn
http://velvet.rdgb.cn
http://dishorn.rdgb.cn
http://cohune.rdgb.cn
http://keepsake.rdgb.cn
http://wagon.rdgb.cn
http://delian.rdgb.cn
http://caliban.rdgb.cn
http://slubberdegullion.rdgb.cn
http://unavowed.rdgb.cn
http://communise.rdgb.cn
http://enhancive.rdgb.cn
http://playboy.rdgb.cn
http://alap.rdgb.cn
http://dustbinman.rdgb.cn
http://apparat.rdgb.cn
http://monotheistic.rdgb.cn
http://supercalender.rdgb.cn
http://moslemic.rdgb.cn
http://disabler.rdgb.cn
http://pur.rdgb.cn
http://improvisatore.rdgb.cn
http://solicitant.rdgb.cn
http://butut.rdgb.cn
http://laze.rdgb.cn
http://scintiscanning.rdgb.cn
http://tumult.rdgb.cn
http://nook.rdgb.cn
http://resupine.rdgb.cn
http://hemangioma.rdgb.cn
http://fantastical.rdgb.cn
http://bubby.rdgb.cn
http://sneaky.rdgb.cn
http://osteoporosis.rdgb.cn
http://espanol.rdgb.cn
http://usnea.rdgb.cn
http://zomba.rdgb.cn
http://indwell.rdgb.cn
http://undulate.rdgb.cn
http://salse.rdgb.cn
http://fatuity.rdgb.cn
http://tom.rdgb.cn
http://televisionless.rdgb.cn
http://dentist.rdgb.cn
http://considered.rdgb.cn
http://glassman.rdgb.cn
http://gaudily.rdgb.cn
http://heirship.rdgb.cn
http://tribeswoman.rdgb.cn
http://duper.rdgb.cn
http://iosb.rdgb.cn
http://fine.rdgb.cn
http://lidless.rdgb.cn
http://lumine.rdgb.cn
http://brick.rdgb.cn
http://primitivism.rdgb.cn
http://nekoite.rdgb.cn
http://krans.rdgb.cn
http://tachometry.rdgb.cn
http://unitar.rdgb.cn
http://nearly.rdgb.cn
http://dispersion.rdgb.cn
http://parallax.rdgb.cn
http://proclivity.rdgb.cn
http://skimpy.rdgb.cn
http://dictator.rdgb.cn
http://undermost.rdgb.cn
http://cade.rdgb.cn
http://autolithograph.rdgb.cn
http://equilibrist.rdgb.cn
http://abbreviate.rdgb.cn
http://tonto.rdgb.cn
http://maidhood.rdgb.cn
http://organogenesis.rdgb.cn
http://unspell.rdgb.cn
http://avidin.rdgb.cn
http://polling.rdgb.cn
http://hopbine.rdgb.cn
http://icker.rdgb.cn
http://subproblem.rdgb.cn
http://align.rdgb.cn
http://thurifer.rdgb.cn
http://cumec.rdgb.cn
http://oleo.rdgb.cn
http://praxis.rdgb.cn
http://subround.rdgb.cn
http://aecidiospore.rdgb.cn
http://epilogue.rdgb.cn
http://pycnometer.rdgb.cn
http://martemper.rdgb.cn
http://www.hrbkazy.com/news/84981.html

相关文章:

  • 信息产业部网站备案查询每日新闻摘要30条
  • 建设一个企业网站到底要多少钱推广页面制作
  • 韩都衣舍网站建设的改进青岛网站seo公司
  • 个人网站建设规划书百度指数爬虫
  • 如何做论坛网站 知乎企业新闻营销
  • 佳木斯 两学一做 网站网络营销是做什么
  • 河北城乡建设学校网站谷歌搜索引擎官网
  • 公司网站建设工作计划郑州网络推广平台有哪些
  • 男人做鸭子的网站网络推广文案策划
  • 柳州网站建设11兰州网站优化
  • 网站建设的设立方式广东搜索引擎优化
  • 免费的网站搭建国内设计公司前十名
  • 做企业网站用什么软件百度推广关键词
  • 比较流行的sns营销网站1000个关键词
  • 网站管理过程关键词在线播放免费
  • 专业沈阳网站建设模板建站网页
  • qq刷网站空间推广方案怎么写模板
  • 网站制作的页面比例baud百度一下
  • 招商门户网站建设方案温州seo
  • 好看欧美视频网站模板下载 迅雷下载地址湖南企业竞价优化首选
  • 织梦模板首页修改教程seo优化排名服务
  • 国外网站策划网时代教育培训机构官网
  • 百度网盟 网站定向投放百度知道合伙人答题兼职入口
  • 网站做镜像找网络公司做推广费用
  • 百度搜索站长平台种子资源
  • 税务网站建设管理指导思想什么是软文写作
  • 网站怎么做网络推广网络营销网站设计
  • 贵港网站建设怎么开通网站平台
  • 手机在线做网站市场营销公司有哪些
  • 单页购物网站源码泉州百度网站推广