Android 3新特性+源码实现

之前一直都在做Android 2.2的,抽点了些时间详细看了下Android 3之后版本,现在最新版本已经实3.2了,感觉版本更新的实太快了,这个Android的一般人还真实很难适应如此更新速度,为了尽量不被其OUT就稍微闲时就对其关注下,写了些简单的实列,由于时间的问题,所以我就把简单的几个新特性直接以源代码的方式贴出来吧。

本源码实现了Android 3的最新特性的实列,有想需要Android 3并不知道从哪里学起的人,可以下去运行起来看效果后再去看代码,这样有处你更好的去掌握与学习相关。

源码下载地址:

相关文件下载地址在Linux公社的1号FTP服务器里,下载地址:

FTP地址:ftp://www.linuxidc.com

用户名:

密码:

在 2011年LinuxIDC.com\8月\Android 3新特性+源码实现

下载方法见这里

项目源码:

package com.jsd.demo;


import android.app.ActivityGroup;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.LinearLayout;


public class MainActivity extends ActivityGroup {


 private Button calendarView,numberPicker,stackVIew,adaViewAnim,popMenu,searchView,notifications;
 private LinearLayout content;
 
 @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        findViewById();
    }
 
 private void findViewById(){
  content = (LinearLayout) findViewById(R.id.content);
  calendarView = (Button) findViewById(R.id.calendarView);
  calendarView.setOnClickListener(listener);
  numberPicker = (Button) findViewById(R.id.numberPicker);
  numberPicker.setOnClickListener(listener);
  stackVIew = (Button) findViewById(R.id.stackView);
  stackVIew.setOnClickListener(listener);
  adaViewAnim = (Button) findViewById(R.id.adaViewAnim);
  adaViewAnim.setOnClickListener(listener);
  popMenu = (Button) findViewById(R.id.popMenu);
  popMenu.setOnClickListener(listener);
  searchView = (Button) findViewById(R.id.searchView);
  searchView.setOnClickListener(listener);
  notifications = (Button) findViewById(R.id.notifications);
  notifications.setOnClickListener(listener);
 }
 
 private OnClickListener listener = new OnClickListener() {
  @Override
  public void onClick(View v) {
   switch (v.getId()) {
   case R.id.calendarView:
    content.removeAllViews();
    content.addView(getLocalActivityManager().startActivity("calendarView", new Intent(MainActivity.this,CalendarActivity.class).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)).getDecorView());
    break;
   case R.id.numberPicker:
    content.removeAllViews();
    content.addView(getLocalActivityManager().startActivity("numberPicker", new Intent(MainActivity.this,NumberPickerActivity.class).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)).getDecorView());
    break;
   case R.id.stackView:
    content.removeAllViews();
    content.addView(getLocalActivityManager().startActivity("stackView", new Intent(MainActivity.this,StackViewActivity.class).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)).getDecorView());
    break;
   case R.id.adaViewAnim:
    content.removeAllViews();
    content.addView(getLocalActivityManager().startActivity("AdapVIewAnimation", new Intent(MainActivity.this,AdapVIewAnimation.class).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)).getDecorView());
    break;
   case R.id.popMenu:
    content.removeAllViews();
    content.addView(getLocalActivityManager().startActivity("popMenu", new Intent(MainActivity.this,PopMenuActivity.class).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)).getDecorView());
    break;
   case R.id.searchView:
    content.removeAllViews();
    content.addView(getLocalActivityManager().startActivity("searchView", new Intent(MainActivity.this,SearchViewDemo.class).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)).getDecorView());
    break;
   case R.id.notifications:
    content.removeAllViews();
    content.addView(getLocalActivityManager().startActivity("notifications", new Intent(MainActivity.this,NotificationActvity.class).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)).getDecorView());
    break;
   }
  }
 };
}


package com.jsd.demo;


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


public class ColorAdapter extends BaseAdapter{

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wwgsws.html