现在位置: 首页 > 移动开发 > 文章
2019年07月20日 移动开发 ⁄ 共 3886字 评论关闭
    标签组件(TabHost)   使用Tab标签可以实现程序的分栏显示。   实现标签的显示界面有两种方式: (1)         直接让一个Activity程序继承TabActivity类; (2)         利用findViewById()方法取得TabHost组件,并进行若干配置。     用第二种方法实现,并让标签在下方(此方法比较麻烦,不推荐使用)     在layout文件夹中新建tab.xml <?xml version="1.0" encoding="utf-8"?> <TabHost   xmlns:android...
阅读全文
2019年07月20日 移动开发 ⁄ 共 2707字 评论关闭
      在main.xml中 <?xml version="1.0" encoding="utf-8"?> <LinearLayout     xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_width="fill_parent"     android:layout_height="fill_parent"     android:orientation="vertical" >       <TextView         android:id="@+id/txt"         android:layout_width="fill_parent"         android:layout_height="wrap_cont...
阅读全文
2019年07月20日 移动开发 ⁄ 共 2114字 评论关闭
      上下文菜单非常类似于Windows操作系统中的右键菜单,在Android操作系统中,用户可以通过长按打开上下文菜单。     在MyMenuDemo.java程序中 package com.li.menu;   import android.app.Activity; import android.os.Bundle; import android.view.ContextMenu; import android.view.ContextMenu.ContextMenuInfo; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.w...
阅读全文
2019年07月20日 移动开发 ⁄ 共 3123字 评论关闭
    在main.xml中 <?xml version="1.0" encoding="utf-8"?> <LinearLayout     xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_width="fill_parent"     android:layout_height="fill_parent"     android:orientation="vertical" >       <TextView         android:id="@+id/txt"         android:layout_width="fill_parent"         android:layout_height="wrap_conten...
阅读全文
2019年07月20日 移动开发 ⁄ 共 2417字 评论关闭
    上下文菜单非常类似于Windows操作系统中的右键菜单,在Android操作系统中,用户可以通过长按打开上下文菜单。       在res下新建menu/mymenu.xml <?xml version="1.0" encoding="utf-8"?> <menu     xmlns:android="http://schemas.android.com/apk/res/android">     <item         android:id="@+id/item01"         android:title="添加联系人"/>     <item         android:id="@+id/item02"   ...
阅读全文
2019年07月20日 移动开发 ⁄ 共 2228字 评论关闭
    在res下新建menu/ editmenu.xml <?xml version="1.0" encoding="utf-8"?> <menu     xmlns:android="http://schemas.android.com/apk/res/android">     <item         android:id="@+id/item04"         android:title="撤销"/>     <item         android:id="@+id/item05"         android:title="恢复"/>  </menu>       在res下新建menu/ filemenu.xml <?xml version="1.0" encodi...
阅读全文
2019年07月20日 移动开发 ⁄ 共 3288字 评论关闭
      SlidingDrawer是一种抽屉型的组件,当用户选中抽屉之后,会得到一些可以使用的“程序集”,这样当一个界面要摆放多个组件的时候,使用此组件就可以很好的解决布局空间紧张的问题。     在main.xml中 <?xml version="1.0" encoding="utf-8"?> <LinearLayout     xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_width="fill_parent"     android:layout_height="fill_parent"   ...
阅读全文
2019年07月20日 移动开发 ⁄ 共 1934字 评论关闭
    在main.xml中 <?xml version="1.0" encoding="utf-8"?> <LinearLayout     xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_width="fill_parent"     android:layout_height="fill_parent"     android:orientation="vertical"     android:gravity="center_horizontal">       <TextView         android:id="@+id/text"         android:layout_marginTop="15dp"      ...
阅读全文
2019年07月20日 移动开发 ⁄ 共 4127字 评论关闭
    既然PopupWindow组件可以在界面上显示一个自己的界面层,那就需要一个专门的布局文件。   只要是组件就一定离不开布局文件。   既然后面要出现的布局是通过PopupWindow文件配置的,那么所有组件必须使用一个转换类。       在main.xml中 <?xml version="1.0" encoding="utf-8"?> <LinearLayout   xmlns:android="http://schemas.android.com/apk/res/android"   android:orientation="vertical"   android:layou...
阅读全文
2019年07月20日 移动开发 ⁄ 共 6070字 评论关闭
    定义一个适配器的操作类MyExpandableAdapter.java package com.li.expandablelistview;   import android.content.Context; import android.view.Gravity; import android.view.View; import android.view.ViewGroup; import android.widget.AbsListView; import android.widget.BaseExpandableListAdapter; import android.widget.TextView; //这是一个专门用于数据填充的组件 public class MyExpandableAdapter extends...
阅读全文