裁缝7.0新背包:android 应用程序学习1
来源:百度文库 编辑:九乡新闻网 时间:2024/07/14 02:28:18
通过安装android sdk的环境大概了解了android应用程序开发。通过eclipse工具写了一个app。package study.android;import android.app.Activity;import android.content.res.Resources;import android.graphics.Color;import android.os.Bundle;import android.util.DisplayMetrics;import android.util.Log;import android.view.View;import android.widget.Button;import android.widget.TextView;import android.graphics.drawable.Drawable;import android.content.Intent;import android.util.*;public class Android_01 extends Activity { private TextView mTextView, mTextView1, mTextView2; private Button mButton1; private static final String TAG = "Android_01"; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); mButton1 = (Button)findViewById(R.id.button1); mTextView = (TextView)findViewById(R.id.textView); mTextView1 = (TextView)findViewById(R.id.textView1); mTextView2 = (TextView)findViewById(R.id.textView2); mTextView1.setText("Change To str1"); Log.v(TAG, "go to onCreate android_01"); // Log.v(); mButton1.setOnClickListener(new Button.OnClickListener() { public void onClick(View v) { mTextView1.setText("onClick change to str1"); mTextView2.setText("onClick change to str2"); //change color //1 getresources way Resources resources1 = getBaseContext().getResources(); Drawable HippoDrawable = resources1.getDrawable(R.drawable.white); // TextView tv = (TextView)findViewById(R.id.text); mTextView1.setBackgroundDrawable(HippoDrawable); mTextView1.setTextColor(Color.MAGENTA); mTextView2.setTextColor(Color.MAGENTA); //mButton1.setBackgroundDrawable(HippoDrawable); mButton1.setTextColor(Color.MAGENTA); CharSequence str_1 = getString(R.string.app_name); CharSequence str_2 = mTextView.getText(); String str_3 = ""; DisplayMetrics dm = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(dm); str_3 = "<手机屏幕的分辨率是:" +="" dm.widthpixels="" +="" "="" x="" "="" +="" dm.heightpixels="" +="" "="">"; mTextView.setText(str_2 + str_3 + str_1); } } ); Button mButton2 = (Button)findViewById(R.id.button2); mButton2.setOnClickListener(new Button.OnClickListener() { public void onClick(View v) { jumptolayout2(); } } ); Button mButton3 = (Button)findViewById(R.id.button3); mButton3.setOnClickListener(new Button.OnClickListener() { public void onClick(View v) { //jumptolayout2(); Intent mIntent = new Intent(); mIntent.setClass(Android_01.this, Android_01_1.class); //调用一个新的activity startActivity(mIntent); //Android_01.this.finish(); } } ); } protected void onRestart() { super.onRestart(); Log.e(TAG, "start onRestart~~~"); } @Override protected void onResume() { super.onResume(); Log.e(TAG, "start onResume~~~"); } @Override protected void onPause() { super.onPause(); Log.e(TAG, "start onPause~~~"); } @Override protected void onStop() { super.onStop(); Log.e(TAG, "start onStop~~~"); } @Override protected void onDestroy() { super.onDestroy(); Log.e(TAG, "start onDestroy~~~"); } public void jumptolayout2() { setContentView(R.layout.layout2); Button mButton2 = (Button)findViewById(R.id.button2); TextView mTextView1 = (TextView)findViewById(R.id.textView1); TextView mTextView2 = (TextView)findViewById(R.id.textView2); mTextView1.setText("layout2 change to str1"); mTextView2.setText("layout2 change to str2"); mButton2.setOnClickListener(new Button.OnClickListener() { public void onClick(View v) { jumptolayout1(); } }); } public void jumptolayout1() { setContentView(R.layout.main); Button mButton2 = (Button)findViewById(R.id.button2); mButton2.setOnClickListener(new Button.OnClickListener() { public void onClick(View v) { jumptolayout2(); } }); }}在这里面有很多知识点的。1.layout转换。2.颜色的使用方法。3.UI上控件的使用。4.activity的使用。5.activity的生命活动周期。6.button的响应方法。7.log的使用方法。手机屏幕的分辨率是:">
android 应用程序学习1
我的Android学习之旅[4]——Android应用程序的生命周期 - royen - 博客园
Android应用程序结构
开发 Standalone Android Java 应用程序
Android Opencore OpenMAX学习(1)
提交应用程序到Android Market教程
Eclipse开发Google Android应用程序教程(一)
用python语言开发android应用程序(1) - 格物致知的博客空间 - 中国移动开发者社区 - Powered by X-Space
Android操作平台手机可以安装不少的应用程序
谷歌推出Android Market网络应用程序商店 - Qzone日志
Android——获取本机安装的应用程序(转)
百度推出基于Android系统的应用程序平台
android jni 学习笔记
Android apk 学习笔记 --- Android apk fundamental ...
android jni 学习笔记飞
android入门之三【应用程序组成】 - 蓝之风 - 博客园
使用Python开发Android应用程序:第一节 在手机上配置Python运行环境
三星主屏幕应用程序(com.sec.android.app.twlauncher)意外停止...
3.4.1 下载APK应用程序
Android Opencore OpenMAX学习(4)
Android Opencore OpenMAX学习(3)
Android Opencore OpenMAX学习(2)
Android学习笔记 ? 进阶:利用9
Android Service学习之本地服务