`

Android学习08-----Android中的基本控件(下)(5)_GridView,AnalogClock与DigitalClock,Chronomete

阅读更多

 

一、网格视图: GridView

1 SimpleAdapter 实现

SimpleAdapterActivity.java

package com.iflytek.demo;

import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.SimpleAdapter;

public class SimpleAdapterActivity extends Activity {
	private GridView myGirdView = null; // 取得组件
	private SimpleAdapter simpleAdapter = null;
	private List<Map<String, Integer>> list = new ArrayList<Map<String, Integer>>();

	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
		this.initAdapter(); // 实例化SimpleAdapter类对象
		this.myGirdView = (GridView) super.findViewById(R.id.myGridView);
		this.myGirdView.setAdapter(this.simpleAdapter);
		this.myGirdView.setOnItemClickListener(new OnItemClickListenerImpl());
	}

	private class OnItemClickListenerImpl implements OnItemClickListener {

		@SuppressWarnings("unchecked")
		@Override
		public void onItemClick(AdapterView<?> parent, View view, int position,
				long id) {
			ImageView showImg = new ImageView(SimpleAdapterActivity.this);
			showImg.setScaleType(ImageView.ScaleType.CENTER); // 图片居中显示
			showImg.setLayoutParams(new LinearLayout.LayoutParams(
					LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
			Map<String, Integer> map = (Map<String, Integer>) parent
					.getAdapter().getItem(position);
			showImg.setImageResource(map.get("img")); // 设置显示图片
			Dialog dialog = new AlertDialog.Builder(SimpleAdapterActivity.this)
					.setIcon(R.drawable.ic_launcher)
					.setTitle("查看图片")
					.setView(showImg)
					.setNegativeButton("关闭",
							new DialogInterface.OnClickListener() {
								@Override
								public void onClick(DialogInterface dialog,
										int which) {
									// TODO Auto-generated method stub

								}
							}).create();
			dialog.show();
		}

	}

	private void initAdapter() {
		Field[] fields = R.drawable.class.getDeclaredFields();
		for (int x = 0; x < fields.length; x++) {
			if (fields[x].getName().startsWith("png_")) {
				Map<String, Integer> map = new HashMap<String, Integer>();
				try {
					map.put("img", fields[x].getInt(R.drawable.class));
				} catch (Exception e) {
				}
				this.list.add(map);
			}
		}
		this.simpleAdapter = new SimpleAdapter(this, this.list,
				R.layout.grid_layout, new String[] { "img" },
				new int[] { R.id.img });
	}
}

main.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 
	xmlns:android="http://schemas.android.com/apk/res/android"
	android:orientation="vertical" 
	android:layout_width="fill_parent"
	android:layout_height="fill_parent">
	<GridView
		android:id="@+id/myGridView"
		android:layout_width="fill_parent"
		android:layout_height="wrap_content" 
		android:numColumns="3"
		android:stretchMode="columnWidth" />
</LinearLayout>

grid_layout.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 
	xmlns:android="http://schemas.android.com/apk/res/android"
	android:orientation="horizontal" 
	android:layout_width="wrap_content"
	android:layout_height="wrap_content"
	android:background="#000000">
	<ImageView
		android:id="@+id/img"
		android:layout_width="wrap_content"
		android:layout_height="wrap_content" 
		android:scaleType="center"
		android:padding="3px" />
</LinearLayout>

2 BaseAdapter

BaseAdapterActivity.java

package com.iflytek.demo;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.LinearLayout;

public class BaseAdapterActivity extends Activity {
	private GridView myGirdView = null; // 取得组件
	private int[] picRes = new int[] { R.drawable.png_01, R.drawable.png_02,
			R.drawable.png_03, R.drawable.png_04, R.drawable.png_05,
			R.drawable.png_06, R.drawable.png_07, R.drawable.png_08,
			R.drawable.png_09, R.drawable.png_10, R.drawable.png_11,
			R.drawable.png_12, R.drawable.png_13, R.drawable.png_14,
			R.drawable.png_15, R.drawable.png_16, R.drawable.png_17,
			R.drawable.png_18, R.drawable.png_19, R.drawable.png_20,
			R.drawable.png_21, R.drawable.png_22, R.drawable.png_23,
			R.drawable.png_24 };

	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
		this.myGirdView = (GridView) super.findViewById(R.id.myGridView);
		this.myGirdView.setAdapter(new ImageAdapter(this, this.picRes));
		this.myGirdView.setOnItemClickListener(new OnItemClickListenerImpl());
	}

	private class OnItemClickListenerImpl implements OnItemClickListener {

		@Override
		public void onItemClick(AdapterView<?> parent, View view, int position,
				long id) {
			ImageView showImg = new ImageView(BaseAdapterActivity.this);
			showImg.setScaleType(ImageView.ScaleType.CENTER); // 图片居中显示
			showImg.setLayoutParams(new LinearLayout.LayoutParams(
					LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
			showImg.setImageResource(BaseAdapterActivity.this.picRes[position]); // 设置显示图片
			Dialog dialog = new AlertDialog.Builder(BaseAdapterActivity.this)
					.setIcon(R.drawable.ic_launcher)
					.setTitle("查看图片")
					.setView(showImg)
					.setNegativeButton("关闭",
							new DialogInterface.OnClickListener() {
								@Override
								public void onClick(DialogInterface dialog,
										int which) {
									// TODO Auto-generated method stub

								}
							}).create();
			dialog.show();
		}

	}
}

ImageAdapter.java

package com.iflytek.demo;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;

public class ImageAdapter extends BaseAdapter {
	private Context context = null;
	private int picIds[] = null;

	public ImageAdapter(Context context, int picIds[]) {
		this.context = context;
		this.picIds = picIds;
	}

	@Override
	public int getCount() {
		return this.picIds.length;
	}

	@Override
	public Object getItem(int position) {
		return this.picIds[position];
	}

	@Override
	public long getItemId(int position) {
		return this.picIds[position];
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		ImageView img = new ImageView(this.context);
		img.setImageResource(this.picIds[position]);
		img.setScaleType(ImageView.ScaleType.CENTER);
		return img;
	}

}

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" >

    <GridView
        android:id="@+id/myGridView"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:numColumns="3"
        android:stretchMode="columnWidth" />

</LinearLayout>

 

二、时钟组件: AnalogClock DigitalClock

main.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 
	xmlns:android="http://schemas.android.com/apk/res/android"
	android:orientation="vertical" 
	android:layout_width="fill_parent"
	android:layout_height="fill_parent">
	<AnalogClock 
		android:layout_width="wrap_content"
		android:layout_height="wrap_content" />
	<DigitalClock
		android:layout_width="wrap_content"
		android:layout_height="wrap_content" />
</LinearLayout>

 

 

三、计时器: Chronometer

1 、控制计时

Chronometer02_Activity.java

package com.iflytek.demo;

import android.app.Activity;
import android.os.Bundle;
import android.os.SystemClock;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Chronometer;

public class Chronometer02_Activity extends Activity {
	private Chronometer myChronometer = null;
	private Button butStart = null;
	private Button butStop = null;
	private Button butBase = null;
	private Button butFormat = null;

	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
		this.myChronometer = (Chronometer) super
				.findViewById(R.id.myChronometer);
		this.butStart = (Button) super.findViewById(R.id.butStart);
		this.butStop = (Button) super.findViewById(R.id.butStop);
		this.butBase = (Button) super.findViewById(R.id.butBase);
		this.butFormat = (Button) super.findViewById(R.id.butFormat);
		this.butStart.setOnClickListener(new OnClickListenerImplStart());
		this.butStop.setOnClickListener(new OnClickListenerImplStop());
		this.butBase.setOnClickListener(new OnClickListenerImplBase());
		this.butFormat.setOnClickListener(new OnClickListenerImplFormat());
	}

	private class OnClickListenerImplStart implements OnClickListener {

		@Override
		public void onClick(View v) {
			Chronometer02_Activity.this.myChronometer.start(); // 开始计时
		}

	}

	private class OnClickListenerImplStop implements OnClickListener {

		@Override
		public void onClick(View v) {
			Chronometer02_Activity.this.myChronometer.stop(); // 停止计时
		}

	}

	private class OnClickListenerImplBase implements OnClickListener {

		@Override
		public void onClick(View v) {
			Chronometer02_Activity.this.myChronometer.setBase(SystemClock
					.elapsedRealtime()); // 开始计时
		}

	}

	private class OnClickListenerImplFormat implements OnClickListener {

		@Override
		public void onClick(View v) {
			Chronometer02_Activity.this.myChronometer.setFormat("新的显示格式:%s。");
		}

	}
}

 

main.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 
	xmlns:android="http://schemas.android.com/apk/res/android"
	android:orientation="vertical" 
	android:layout_width="fill_parent"
	android:layout_height="fill_parent">
	<Chronometer
		android:id="@+id/myChronometer"
		android:layout_width="fill_parent"
		android:layout_height="wrap_content" />
	<LinearLayout 
		xmlns:android="http://schemas.android.com/apk/res/android"
		android:orientation="horizontal" 
		android:layout_width="fill_parent"
		android:layout_height="fill_parent">
		<Button
			android:id="@+id/butStart"
			android:text="开始计时"
			android:layout_width="wrap_content"
			android:layout_height="wrap_content" />
		<Button
			android:id="@+id/butStop"
			android:text="停止计时"
			android:layout_width="wrap_content"
			android:layout_height="wrap_content" />
		<Button
			android:id="@+id/butBase"
			android:text="复位"
			android:layout_width="wrap_content"
			android:layout_height="wrap_content" />
		<Button
			android:id="@+id/butFormat"
			android:text="格式化"
			android:layout_width="wrap_content"
			android:layout_height="wrap_content" />
	</LinearLayout>
</LinearLayout>

2 、定时震动

Chronometer03_Activity.java

package com.iflytek.demo;

import android.app.Activity;
import android.app.Service;
import android.os.Bundle;
import android.os.Vibrator;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Chronometer;
import android.widget.Chronometer.OnChronometerTickListener;

public class Chronometer03_Activity extends Activity {
	private Chronometer myChronometer = null;
	private Button butStart = null;
	private Button butStop = null;
	private Vibrator vibrator = null; // 震动操作

	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
		this.vibrator = (Vibrator) super.getApplication().getSystemService(
				Service.VIBRATOR_SERVICE); // 取得震动服务

		this.myChronometer = (Chronometer) super
				.findViewById(R.id.myChronometer);
		this.butStart = (Button) super.findViewById(R.id.butStart);
		this.butStop = (Button) super.findViewById(R.id.butStop);

		this.myChronometer.setFormat("当前计时时间:%s。");

		this.myChronometer
				.setOnChronometerTickListener(new OnChronometerTickListenerImpl());

		this.butStart.setOnClickListener(new OnClickListenerImplStart());
		this.butStop.setOnClickListener(new OnClickListenerImplStop());
	}

	private class OnChronometerTickListenerImpl implements
			OnChronometerTickListener {

		@Override
		public void onChronometerTick(Chronometer chronometer) {
			String time = chronometer.getText().toString()
					.replaceAll("[^(\\d{2}:\\d{2})]", "");
			Log.i("Chronometer03_Activity", time);
			if ("01:00".equals(time)) {
				Chronometer03_Activity.this.vibrator.vibrate(new long[] { 1000,
						10, 100, 100 }, 0); // 重复震动
			}
		}
	}

	private class OnClickListenerImplStart implements OnClickListener {

		@Override
		public void onClick(View v) {
			Chronometer03_Activity.this.myChronometer.start(); // 开始计时
		}

	}

	private class OnClickListenerImplStop implements OnClickListener {

		@Override
		public void onClick(View v) {
			Chronometer03_Activity.this.myChronometer.stop(); // 停止计时
		}

	}
}

main.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 
	xmlns:android="http://schemas.android.com/apk/res/android"
	android:orientation="vertical" 
	android:layout_width="fill_parent"
	android:layout_height="fill_parent">
	<Chronometer
		android:id="@+id/myChronometer"
		android:layout_width="fill_parent"
		android:layout_height="wrap_content" />
	<LinearLayout 
		xmlns:android="http://schemas.android.com/apk/res/android"
		android:orientation="horizontal" 
		android:layout_width="fill_parent"
		android:layout_height="fill_parent">
		<Button
			android:id="@+id/butStart"
			android:text="开始计时"
			android:layout_width="wrap_content"
			android:layout_height="wrap_content" />
		<Button
			android:id="@+id/butStop"
			android:text="停止计时"
			android:layout_width="wrap_content"
			android:layout_height="wrap_content" /> 
	</LinearLayout>
</LinearLayout>

 

四、标签: TabHost

1 、通过继承 TabActivity

TabHost01_Activity.java

package com.iflytek.demo;

import android.app.TabActivity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.widget.TabHost;
import android.widget.TabHost.TabSpec;

public class TabHost01_Activity extends TabActivity { // 继承了TabActivity
	private TabHost myTabHost;
	private int[] layRes = new int[] { R.id.tab_edit, R.id.tab_clock,
			R.id.tab_sex }; // 这些是内嵌布局文件的ID

	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		this.myTabHost = super.getTabHost(); // 取得TabHost对象
		LayoutInflater.from(this).inflate(R.layout.tab,
				this.myTabHost.getTabContentView(), true); // true表示实例化布局文件中的组件
		for (int x = 0; x < this.layRes.length; x++) {
			TabSpec myTab = this.myTabHost.newTabSpec("tab" + x);
			myTab.setIndicator("标签  - " + x);
			myTab.setContent(this.layRes[x]);
			this.myTabHost.addTab(myTab);
		}
	}
}

tab.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 
	xmlns:android="http://schemas.android.com/apk/res/android"
	android:orientation="vertical" 
	android:layout_width="fill_parent"
	android:layout_height="fill_parent">
	<LinearLayout 
		xmlns:android="http://schemas.android.com/apk/res/android"
		android:id="@+id/tab_edit"
		android:orientation="vertical" 
		android:layout_width="fill_parent"
		android:layout_height="fill_parent">
		<EditText
			android:id="@+id/edit" 
			android:layout_width="wrap_content"
			android:layout_height="wrap_content" 
			android:text="请输入检索关键字..."
			android:textSize="18px" />
		<Button
			android:id="@+id/but"
			android:layout_width="wrap_content"
			android:layout_height="wrap_content"
			android:text="搜索" />
	</LinearLayout>
	<LinearLayout 
		xmlns:android="http://schemas.android.com/apk/res/android"
		android:id="@+id/tab_clock"
		android:orientation="vertical" 
		android:layout_width="fill_parent"
		android:layout_height="fill_parent">
		<AnalogClock
			android:id="@+id/myAnalogClock" 
			android:layout_width="wrap_content"
			android:layout_height="wrap_content"/>
	</LinearLayout>
	<LinearLayout 
		xmlns:android="http://schemas.android.com/apk/res/android"
		android:id="@+id/tab_sex"
		android:orientation="vertical" 
		android:layout_width="fill_parent"
		android:layout_height="fill_parent">
		<RadioGroup
			android:id="@+id/sex" 
			android:layout_width="wrap_content"
			android:layout_height="wrap_content"
			android:orientation="vertical">
			<RadioButton
				android:id="@+id/male"
				android:checked="true"
				android:text="性别:男" />
			<RadioButton
				android:id="@+id/female"
				android:text="性别:女" />
		</RadioGroup>
	</LinearLayout>
</LinearLayout>

2 、继承 Activity

TabHost02_Activity.java

package com.iflytek.demo;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TabHost;
import android.widget.TabHost.TabSpec;

public class TabHost02_Activity extends Activity { // 继承了TabActivity
	private TabHost myTabHost;
	private int[] layRes = new int[] { R.id.tab_edit, R.id.tab_clock,
			R.id.tab_sex }; // 这些是内嵌布局文件的ID

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		super.setContentView(R.layout.tab);
		this.myTabHost = (TabHost) super.findViewById(R.id.tabhost);
		this.myTabHost.setup(); // 建立TabHost对象
		for (int x = 0; x < this.layRes.length; x++) {
			TabSpec myTab = this.myTabHost.newTabSpec("tab" + x);
			myTab.setIndicator("标签  - " + x);
			myTab.setContent(this.layRes[x]);
			this.myTabHost.addTab(myTab);
		}
		this.myTabHost.setCurrentTab(0); // 默认显示的标签索引
	}
}

3 、标签在下方

package com.iflytek.demo;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TabHost;
import android.widget.TabHost.TabSpec;

public class TabHost03_Activity extends Activity {
	private TabHost myTabHost;
	private int[] layRes = new int[] { R.id.tab_edit, R.id.tab_clock,
			R.id.tab_sex }; // 这些是内嵌布局文件的ID

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		super.setContentView(R.layout.tab);
		this.myTabHost = (TabHost) super.findViewById(R.id.tabhost);
		this.myTabHost.setup(); // 建立TabHost对象
		for (int x = 0; x < this.layRes.length; x++) {
			TabSpec myTab = this.myTabHost.newTabSpec("tab" + x);
			myTab.setIndicator("标签  - " + x);
			myTab.setContent(this.layRes[x]);
			this.myTabHost.addTab(myTab);
		}
		this.myTabHost.setCurrentTab(0); // 默认显示的标签索引
	}
}

 

 

 

分享到:
评论

相关推荐

    Android控件及布局的使用

    ### Android控件及布局的使用知识点详解 #### 第一章:Android基础 ...通过以上知识点的学习,开发者可以更深入地理解Android控件及布局的应用,并能够熟练地在自己的应用中使用这些控件来提升用户体验。

    Android核心技术开发与实例详解—目录.pdf

    - **4.6.1 AnalogClock和DigitalClock类简介**:介绍模拟时钟和数字时钟控件的特点及其使用方法。 - **4.6.2 时钟控件使用案例**:通过实例展示时钟控件的应用技巧。 - **4.7 日期与时间选择控件** - **4.7.1 ...

    Google Android SDK开发范例大全(PDF高清完整版1)(4-1)

    4.14 数字及模拟小时钟设计——AnalogClock与DigitalClock的原理 4.15 动态输入日期与时间——DatePicker与TimePicker应用 4.16 猜猜红心A在那儿——ImageView点击事件与透明度处理 4.17 后台程序运行进度提示——...

    Google Android SDK开发范例大全(PDF完整版4)(4-4)

    4.14 数字及模拟小时钟设计——AnalogClock与DigitalClock的原理 4.15 动态输入日期与时间——DatePicker与TimePicker应用 4.16 猜猜红心A在那儿——ImageView点击事件与透明度处理 4.17 后台程序运行进度提示——...

    Google Android SDK开发范例大全(PDF高清完整版3)(4-3)

    4.14 数字及模拟小时钟设计——AnalogClock与DigitalClock的原理 4.15 动态输入日期与时间——DatePicker与TimePicker应用 4.16 猜猜红心A在那儿——ImageView点击事件与透明度处理 4.17 后台程序运行进度提示——...

    Android2.2 API中文文档——View

    在Android开发中,`View`是最基本的UI组件,所有可见的用户界面元素都是通过继承`View`类实现的。`View`类定义了控件的行为和外观,并且提供了绘制、布局、处理触摸事件等功能。本文档将详细介绍Android2.2版本中的`...

    Google Android SDK开发范例大全.docx

    - **4.14 数字及模拟小时钟设计——AnalogClock与DigitalClock的原理** 介绍了两种显示时间的方式:模拟时钟(AnalogClock)和数字时钟(DigitalClock),并探讨了它们的实现原理。 - **4.15 动态输入日期与时间——...

    Google Android SDK开发范例大全的目录

    4.14 数字及模拟小时钟设计——AnalogClock与DigitalClock的原理 4.15 动态输入日期与时间——DatePicker与TimePicker应用 4.16 猜猜红心A在那儿——ImageView点击事件与透明度处理 4.17 后台程序运行进度提示——...

    Google Android SDK开发范例大全(完整版附部分源码).pdf

    4.14 数字及模拟小时钟设计——AnalogClock与DigitalClock的原理 4.15 动态输入日期与时间——DatePicker与TimePicker应用 4.16 猜猜红心A在那儿——ImageView点击事件与透明度处理 4.17 后台程序运行进度提示...

    Android_UI类继承关系图

    Android UI类继承关系图描述了Android开发中,用户界面组件之间的层次结构和继承关系。在Android开发中,UI组件构建在一种称为View的类之上,View又是Object的子类,构成了一个庞大的类体系。通过继承关系图,开发者...

    Google Android SDK 开发范例大全02

    4.14 数字及模拟小时钟设计——AnalogClock与DigitalClock的原理 4.15 动态输入日期与时间——DatePicker与TimePicker应用 4.16 猜猜红心A在那儿——ImageView点击事件与透明度处理 4.17 后台程序运行进度提示——...

    Google Android SDK 开发范例大全01

    4.14 数字及模拟小时钟设计——AnalogClock与DigitalClock的原理 4.15 动态输入日期与时间——DatePicker与TimePicker应用 4.16 猜猜红心A在那儿——ImageView点击事件与透明度处理 4.17 后台程序运行进度提示——...

    Google Android sdk 开发范例大全 部分章节代码

    4.14 数字及模拟小时钟设计——AnalogClock与DigitalClock的原理 4.15 动态输入日期与时间——DatePicker与TimePicker应用 4.16 猜猜红心A在那儿——ImageView点击事件与透明度处理 4.17 后台程序运行进度提示——...

    Android开发规范

    在Android开发中,遵循一套规范是非常重要的,它能提高代码的可读性、可维护性和团队协作效率。以下是一些关键的Android开发规范和注意事项: **布局方面:** 1. **优先使用线性布局(LinearLayout)**,因为它简单...

    Google+Android+SDK开发范例大全

    4.14 数字及模拟小时钟设计——AnalogClock与DigitalClock的原理 4.15 动态输入日期与时间——DatePicker与TimePicker应用 4.16 猜猜红心A在那儿——ImageView点击事件与透明度处理 4.17 后台程序运行进度提示——...

    Android基础知识详解

    AnalogClock、DigitalClock 68 单选框、复选框、开关状态按钮 69 单项选择(RadioGroup、RadioButton) 69 复选框(CheckBox) 71 开关状态按钮(ToggleButton) 73 下拉列表框Spinner 74 ScrollView、...

Global site tag (gtag.js) - Google Analytics