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

网站建设合同书 简易坑梓网站建设包括哪些

网站建设合同书 简易,坑梓网站建设包括哪些,wordpress主题中心开发,网站域名怎么选择今天自己简单的总结了listActivity和ExpandableListActivity二者的简单用法。 首先#xff0c;先说一下listActivity的用法#xff1a; ListActivity是一个绑定到一个数据源#xff0c;并且用来显示这一串数据的Activity。ListActivity拥有一个listview对象来实现数据源的绑…  今天自己简单的总结了listActivity和ExpandableListActivity二者的简单用法。   首先先说一下listActivity的用法   ListActivity是一个绑定到一个数据源并且用来显示这一串数据的Activity。ListActivity拥有一个listview对象来实现数据源的绑定与显示通常会是一个array或者一个拥有查询结果的cursor.ListActivity本身有一个默认的layout其中包含一个全屏的list。如果用默认的layout你必须要在onCreate()中注释掉setContentView()那一句。但是如果你如果你想要定制自己的layout你可以创建一个你自己的layout文件并且在onCreate()中调用setContentView()来指定这个layout.需要注意的是你自己的layout中必须用到系统给定的id为android:id/list的ListView。   下面是一个简单的例子运行结果如下 activityde 代码如下 package lm.muilThreadDownload;import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map;import lm.muilThreadEntity.DownloadInfo; import lm.muilThreadService.Downloader;import android.app.ListActivity; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.util.Log; import android.view.View; import android.widget.LinearLayout; import android.widget.ProgressBar; import android.widget.SimpleAdapter; import android.widget.TextView; import android.widget.Toast;public class MuilThreadDownloadActivity extends ListActivity { Overridepublic void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.main);showListView();//显示listView}private void showListView() {ListMapString, String data new ArrayListMapString, String();MapString, String map new HashMapString, String();map.put(name, liming.mp3);data.add(map);map new HashMapString, String();map.put(name, liming2.mp3);data.add(map);map new HashMapString, String();map.put(name, liming3.mp3);data.add(map);SimpleAdapter adapter new SimpleAdapter(this, data,R.layout.list_item, new String[] { name },new int[] { R.id.tv_resouce_name });setListAdapter(adapter);} }xml文件的代码如下 ?xml version1.0 encodingutf-8? LinearLayout xmlns:androidhttp://schemas.android.com/apk/res/androidandroid:orientationverticalandroid:layout_widthfill_parentandroid:layout_heightfill_parentandroid:idid/mainlayout ListViewandroid:idandroid:id/list android:layout_widthfill_parent android:layout_heightfill_parent / /LinearLayout我们看到上面的ListView的id用的就是系统自带的android:id/list。 其次我们也可以不用布局文件自己定义一个ListView的对象通过id来获得加载的视图文件。具体代码如下 package lm.mediaPlayer;import android.app.ListActivity; import android.content.Intent; import android.content.IntentFilter; import android.net.Uri; import android.os.Bundle; import android.os.Environment; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.ArrayAdapter; import android.widget.ListView;public class MyMediaPlayerActivity extends ListActivity {private ListView listView;private ScannerSDCardReceiver receiver;private boolean b false;Overridepublic void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);listView new ListView(this);listView.setId(android.R.id.list);//获得listView的idsetContentView(listView);//加载listViewshowListView();}private void showListView() {//显示listViewString[] from {全部音乐,最近播放音乐};ArrayAdapterString adapter new ArrayAdapterString(this,android.R.layout.simple_list_item_1,from);listView.setAdapter(adapter);} }运行结果如下   最后我们看一下ExpandableListActivity的用法开始运行效果图如下 当我们展开向右的箭头时效果如下 我们看到“国家”和“语言”分别是组名每个组名下面还有很多child中国美国汉语英语其实ExpandableListActivity就是实现这样的功能能更方便的现实一些列表信息。具体代码如下 package lm.expendablelistAcitivity; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map;import android.app.ExpandableListActivity; import android.os.Bundle; import android.widget.SimpleExpandableListAdapter; //首先继承ExpandableListActivity public class MyExpendableListActivityActivity extends ExpandableListActivity{/** Called when the activity is first created. */Overridepublic void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.main);ListMapString,String list new ArrayListMapString,String();//组名MapString,String map1 new HashMapString,String();map1.put(group, 国家);MapString,String map2 new HashMapString,String();map2.put(group, 语言);list.add(map1);list.add(map2);ListMapString,String listChild1 new ArrayListMapString,String();//childMapString,String map3 new HashMapString,String();map3.put(country, 中国);listChild1.add(map3);MapString,String map4 new HashMapString,String();map4.put(country, 美国);listChild1.add(map4);ListMapString,String listChild2 new ArrayListMapString,String();//childMapString,String map5 new HashMapString,String();map5.put(country, 汉语);listChild2.add(map5);MapString,String map6 new HashMapString,String();map6.put(country, 英语);listChild2.add(map6);ListListMapString,String childs new ArrayListListMapString,String();//将两个child加入的集合中childs.add(listChild1);childs.add(listChild2);SimpleExpandableListAdapter adapter new SimpleExpandableListAdapter(this, list, R.layout.group, new String[]{group},new int[]{R.id.tv_group}, childs, R.layout.child, new String[]{country}, new int[]{R.id.tv_child});setListAdapter(adapter);//适配器} }其中group的xml文件代码如下 ?xml version1.0 encodingutf-8? LinearLayout xmlns:androidhttp://schemas.android.com/apk/res/androidandroid:orientationverticalandroid:layout_widthfill_parentandroid:layout_heightfill_parent TextViewandroid:idid/tv_group android:layout_widthfill_parent android:layout_heightfill_parent android:paddingLeft60pxandroid:paddingTop10pxandroid:paddingBottom10pxandroid:textSize25spandroid:text无数据/ /LinearLayoutchild的xml文件代码如下 ?xml version1.0 encodingutf-8? LinearLayout xmlns:androidhttp://schemas.android.com/apk/res/androidandroid:orientationverticalandroid:layout_widthfill_parentandroid:layout_heightfill_parent TextViewandroid:idid/tv_child android:layout_widthfill_parent android:layout_heightfill_parent android:paddingLeft50pxandroid:paddingTop5pxandroid:paddingBottom5pxandroid:textSize20spandroid:text无数据/ /LinearLayout好了以上就是我总结的内容希望大家多多指教 转载于:https://www.cnblogs.com/limingblogs/archive/2011/10/09/2204866.html
http://www.zqtcl.cn/news/891685/

相关文章:

  • 深圳网站建设ue网站空间和流量
  • 网站前端设计要做什么游仙建设局官方网站
  • 大型门户网站建设哪家好进一步加大网站集约化建设力度
  • 网站里面那些工作是做晚上兼职的钱包网站建设策划
  • 网站开发实现的环境自豪地采用wordpress 怎么去掉
  • ic商城网站建设网站备案关闭影响排名
  • qq官方网站进入wordpress调用文章某个分类
  • 南充网站建设设计略奥企业网站管理系统怎么修改密码
  • 网站建设里的知识360云主机可以建设网站吗
  • 创建网站代码上海网络公司查询
  • 电子商务网站建设与管理实训报告百度权重划分等级
  • 网站建设响应式是什么医院网站建设方案策划书
  • 开鲁网站seo不用下载男女做羞羞事动画网站免费
  • 做网站客户需求新乡专业做网站多少钱
  • 邢台建设银行官方网站二维码生成器app下载
  • 自己怎么做网站游戏做网站就是做app
  • 怎样做一元购网站wordpress+淘客代码
  • 网站建设发展现状贵阳有哪些做网站的公司
  • 微博上如何做网站推广蝉知和wordpress
  • 泷澄建设集团网站北京建设执业资格注册网站
  • 门户网站建设情况报告深圳龙岗房价多少钱一平方米
  • 网站建设备案是什么ps培训班
  • 深圳网站推广优化wordpress 运行速度慢
  • 谁能给个网站谢谢发布广东建设工程信息网站
  • 网站建设用户需求分析中国加盟网
  • 建设上线网站seo关键词优化软件排名
  • 郑州手工网站建设公司企业做网站好做吗
  • 苏华建设集团网站产品营销网站
  • 郑州专业做网站的网站收录最好的方法
  • 微信小程序网站建设哪家好视频教学网站开发