在手机应用中菜单是很重要的一部分,它能够以直观的界面让用户去选择,现在我们学习如何去新建一个菜单。 首先在res目录下新建一个menu文件夹,然后在menu文件夹下新建一个Android XML File文件并命名为main。然后在 main.xml中添加如下代码: 代码中的标签就是用来创建具体的某...
分类:
移动开发 时间:
2015-01-22 23:09:28
阅读次数:
255
1,ActionBar的几种形式2,使用ActionBar需要Activity开启了带ActionBar的主题Theme.Holo
分类:
移动开发 时间:
2015-01-22 17:59:40
阅读次数:
163
FileService.java也就是操作sdcard的工具类:?123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263...
分类:
移动开发 时间:
2015-01-21 10:11:57
阅读次数:
154
(1)布局文件如下:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_hei...
分类:
移动开发 时间:
2015-01-20 15:47:59
阅读次数:
193
(1)第一种使用xml文件进行注册
布局文件,添加一个button点击的时候进行广播
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="mat...
分类:
移动开发 时间:
2015-01-20 15:43:35
阅读次数:
154
(1)目录结构如下:
(2)链接数据库的文件:DBHelper.java要继承SQLiteOpenHelper类
package com.lc.sqlite_demo1.db;
import android.content.Context;
import android.database.DatabaseErrorHandler;
import android.database.sq...
分类:
移动开发 时间:
2015-01-19 22:46:57
阅读次数:
244
一、第一种方法:
(1)Fragment的第一种使用方法是使用fragment加载单独的布局文件:(也就是xml的方式实现)
结构如下:
activity_main.xml主要是在一个线性布局中添加两个线性布局
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:t...
分类:
移动开发 时间:
2015-01-19 22:46:36
阅读次数:
173
Google在Android4.0之后加入了Action Bar的功能。但是有时候标题栏会相当占用屏幕空间,使得内容区域变小,这里演示如何隐藏标题栏。隐藏标题栏的方法很简单,打开上节的FirstActivity,在onCreate()方法中添加如下代码:protected void onCreate...
分类:
移动开发 时间:
2015-01-19 22:37:34
阅读次数:
277
(1)文件的目录
(2)各文件的代码:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
andr...
分类:
移动开发 时间:
2015-01-18 18:36:59
阅读次数:
246
(1)目录结构
(2) 布局文件:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
androi...
分类:
移动开发 时间:
2015-01-18 14:24:30
阅读次数:
187