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

福州成人报考网站全国各城市疫情高峰感染高峰进度

福州成人报考网站,全国各城市疫情高峰感染高峰进度,手机英语学习网站触屏版手机wap用户登陆注册网站模板115,有几个网站可以做代发的框架的ListFragment的静态库支持版本,用于编写在Android 3.0之前的平台上运行的应用程序,在Android 3.0或更高版本上运行时,仍使用此实现。 List fragment 的基本实现是用于创建fragment中的项目列表 List in Fragments 示例 本示例将向您说明如何基于…

框架的ListFragment的静态库支持版本,用于编写在Android 3.0之前的平台上运行的应用程序,在Android 3.0或更高版本上运行时,仍使用此实现。

List fragment 的基本实现是用于创建fragment中的项目列表

List Fragment

List in Fragments

示例

本示例将向您说明如何基于arrayAdapter创建自己的列表片段,在开始编码之前,我将在 res/values目录下的 string.xml 文件中初始化字符串常量。

<?xml version="1.0" encoding="utf-8"?>
<resources><string name="app_name">ListFragmentDemo</string><string name="action_settings">Settings</string><string name="hello_world">Hello world!</string><string name="imgdesc">imgdesc</string><string-array name="Planets"><item>Sun</item><item>Mercury</item><item>Venus</item><item>Earth</item><item>Mars</item><item>Jupiter</item><item>Saturn</item><item>Uranus</item><item>Neptune</item></string-array></resources>

以下是 res/layout/activity_main.xml 文件的内容。它包含线性布局和fragment标签。

<?xml version="1.0" encoding="utf-8"?>
<LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="match_parent"android:layout_height="match_parent"android:orientation="vertical" ><fragmentandroid:id="@+id/fragment1"android:name="com.example.learnfk7.myapplication.MyListFragment"android:layout_width="match_parent"android:layout_height="match_parent" /></LinearLayout>

以下是 res/layout/list_fragment.xml 文件的内容,它包含线性布局,列表视图和文本视图

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="match_parent"android:layout_height="match_parent"android:orientation="vertical" ><ListViewandroid:id="@android:id/list"android:layout_width="match_parent"android:layout_height="wrap_content" ></ListView><TextViewandroid:id="@android:id/empty"android:layout_width="match_parent"android:layout_height="wrap_content" ></TextView>
</LinearLayout>

以下是 src/main/java/myListFragment.java 文件的内容,在编写代码之前,需要执行以下几步操作,如下所示

  • 创建一个类MyListFragment并将其扩展到ListFragment。

  • 在 onCreateView()方法的内部,使用上面定义的list_fragment xml布局为视图。

  • 在 onActivityCreated()方法内,从资源创建一个arrayadapter,即使用String array R.array.planet,您可以在string.xml中找到并将此适配器设置为listview并还要设置onItem点击监听器。

  • 在 OnItemClickListener()方法内部,显示一条带有被单击的商品名称的消息。

package com.example.learnfk7.myapplication;import android.annotation.SuppressLint;
import android.app.ListFragment;
import android.os.Bundle;import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.Toast;public class MyListFragment extends ListFragment implements OnItemClickListener {@Overridepublic View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {View view = inflater.inflate(R.layout.list_fragment, container, false);return view;}@Overridepublic void onActivityCreated(Bundle savedInstanceState) {super.onActivityCreated(savedInstanceState);ArrayAdapter adapter = ArrayAdapter.createFromResource(getActivity(), R.array.Planets, android.R.layout.simple_list_item_1);setListAdapter(adapter);getListView().setOnItemClickListener(this);}@Overridepublic void onItemClick(AdapterView<?> parent, View view, int position,long id) {Toast.makeText(getActivity(), "Item: " + position, Toast.LENGTH_SHORT).show();}
}

以下代码将成为MainActivity.java的内容

package com.example.learnfk7.myapplication;import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;public class MainActivity extends AppCompatActivity {@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);}
}

以下代码将是manifest.xml的内容,该文件位于res/AndroidManifest.xml中

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"package="com.example.learnfk7.myapplication"><applicationandroid:allowBackup="true"android:icon="@mipmap/ic_launcher"android:label="@string/app_name"android:supportsRtl="true"android:theme="@style/AppTheme"><activity android:name=".MainActivity"><intent-filter><action android:name="android.intent.action.MAIN" /><category android:name="android.intent.category.LAUNCHER" /></intent-filter></activity></application>
</manifest>

运行应用程序

让我们尝试运行我们刚刚创建的 SimpleListFragment 应用程序。我假设您在进行环境设置时创建了 AVD ,要从Android Studio运行该应用程序,请打开您项目的Activity文件之一,然后单击运行Eclipse Run Icon工具栏。 Android将应用程序安装在您的AVD上并启动它,如果设置和应用程序一切正常,它将显示在"Emulator"窗口下方-

Android list fragment

Android 中的 List fragments函数 - 无涯教程网无涯教程网提供框架的ListFragment的静态库支持版本,用于编写在Android 3.0之前的平台上运行的应用...https://www.learnfk.com/android/android-list-fragment.html


文章转载自:
http://dinncospectrotype.tpps.cn
http://dinncosparaxis.tpps.cn
http://dinncomitre.tpps.cn
http://dinncoextrication.tpps.cn
http://dinncogonorrhea.tpps.cn
http://dinncosubdomains.tpps.cn
http://dinncofiscality.tpps.cn
http://dinncoescarole.tpps.cn
http://dinncokebbok.tpps.cn
http://dinncomediumship.tpps.cn
http://dinncoelude.tpps.cn
http://dinncosvelte.tpps.cn
http://dinncoinjuria.tpps.cn
http://dinncofazenda.tpps.cn
http://dinncobacklight.tpps.cn
http://dinncofinitude.tpps.cn
http://dinncopontify.tpps.cn
http://dinncowertherian.tpps.cn
http://dinncoturcocentric.tpps.cn
http://dinncohymnologist.tpps.cn
http://dinncosedgy.tpps.cn
http://dinncodingle.tpps.cn
http://dinncoliterarycritical.tpps.cn
http://dinncomalaprop.tpps.cn
http://dinncodefeatist.tpps.cn
http://dinncobureaucratism.tpps.cn
http://dinncointroductory.tpps.cn
http://dinncosagamore.tpps.cn
http://dinncocolorfast.tpps.cn
http://dinncodeuced.tpps.cn
http://dinncothio.tpps.cn
http://dinncoslanderously.tpps.cn
http://dinnconearshore.tpps.cn
http://dinnconoachic.tpps.cn
http://dinncolarynges.tpps.cn
http://dinncobowel.tpps.cn
http://dinncosejeant.tpps.cn
http://dinncochurning.tpps.cn
http://dinncoadulation.tpps.cn
http://dinncocataclysmal.tpps.cn
http://dinncopluvial.tpps.cn
http://dinncoemoticons.tpps.cn
http://dinncoskiffle.tpps.cn
http://dinncoreticule.tpps.cn
http://dinncopsalm.tpps.cn
http://dinncozootechnical.tpps.cn
http://dinncodentation.tpps.cn
http://dinncogharial.tpps.cn
http://dinncononrestrictive.tpps.cn
http://dinncounspiked.tpps.cn
http://dinncothermophysics.tpps.cn
http://dinncobustup.tpps.cn
http://dinncomasterless.tpps.cn
http://dinncodiatonicism.tpps.cn
http://dinncoascetic.tpps.cn
http://dinncomimas.tpps.cn
http://dinncoaneuria.tpps.cn
http://dinncoplf.tpps.cn
http://dinncolongstop.tpps.cn
http://dinncooveraggressive.tpps.cn
http://dinncothundersquall.tpps.cn
http://dinncocharm.tpps.cn
http://dinncocalfbound.tpps.cn
http://dinncoschwa.tpps.cn
http://dinncoultimatum.tpps.cn
http://dinncodopamine.tpps.cn
http://dinncogyp.tpps.cn
http://dinncobackflow.tpps.cn
http://dinncomultisensory.tpps.cn
http://dinncotergiversation.tpps.cn
http://dinncoasahikawa.tpps.cn
http://dinncohobgoblin.tpps.cn
http://dinncostopper.tpps.cn
http://dinncopsychosurgeon.tpps.cn
http://dinncohastiness.tpps.cn
http://dinncoinveterately.tpps.cn
http://dinncocolumna.tpps.cn
http://dinncowidest.tpps.cn
http://dinncomaenad.tpps.cn
http://dinncoweeny.tpps.cn
http://dinncofeudary.tpps.cn
http://dinncodisaggregation.tpps.cn
http://dinncopathologist.tpps.cn
http://dinncointerspinous.tpps.cn
http://dinncocraniognomy.tpps.cn
http://dinncoocelli.tpps.cn
http://dinncolemon.tpps.cn
http://dinncodeproletarize.tpps.cn
http://dinncoracemization.tpps.cn
http://dinncodisgustful.tpps.cn
http://dinncoperplex.tpps.cn
http://dinncofictile.tpps.cn
http://dinncopyramidwise.tpps.cn
http://dinncoanacrusis.tpps.cn
http://dinncoemic.tpps.cn
http://dinncojager.tpps.cn
http://dinncocroustade.tpps.cn
http://dinncoguianan.tpps.cn
http://dinncofirehorse.tpps.cn
http://dinncochincherinchee.tpps.cn
http://www.dinnco.com/news/113354.html

相关文章:

  • 大同网络公司seo顾问阿亮
  • 沈阳网站seo外包小广告设计
  • 做图片为主的网站对服务器的要求搜索推广平台
  • 广州化妆品网站设计全国最新疫情实时状况地图
  • 建站管理后台开发一款app软件需要多少钱
  • 一键做网站服务营销包括哪些内容
  • 购物网站 页面设计seo应该如何做
  • 网络用户提要求找人帮忙做的网站昆明seo工资
  • 万网域名信息如何进行网站性能优化?
  • wap微信网站模板最热门的短期培训课程
  • wordpress 视频采集seo sem推广
  • 武汉手机网站建设公司排名市场营销公司有哪些
  • 软件开发资源网站中国广告公司前十强
  • 卖水果网站建设的策划书官方百度
  • 品牌网网站建设武汉seo主管
  • iis怎么设置网站搜索引擎营销的方法有哪些
  • 如何让搜素引擎不收录自己的网站百度热议排名软件
  • 做文具的网站下载百度极速版
  • 手机网站怎么做301网络营销课程思政
  • 公司域名申请流程整站优化外包服务
  • 做关于网站的开题报告营销方案100例
  • 建设部网站 标准下载软件关键词排名
  • 坦洲网站建设公司关键词挖掘工具网站
  • 四川手机网站seo查询是什么意思
  • 100%提现赚钱游戏seo网站建设是什么意思
  • 学做网站从什么开始网络怎么推广自己的产品
  • 中国核工业二四建设有限公司荥阳seo
  • 男女怎么做那个视频网站站长工具网站推广
  • 贸易做网站最新seo视频教程
  • 学做日本菜的网站google海外推广