摘要: *************用SharedPrefences保存键值对*********************//获得SharedPrefences对象SharedPreferences mySharedPreferences=getSharedPreferences("test",Activity.MODE_PRIVATE);//获得SharedPreferences.Editor对象SharedPreferences.Editor editor=mySharedPreferences.edit();//用putXxx方法保存数据editor.putString(&quo 阅读全文
posted @ 2012-09-24 18:00 言程序 阅读(994) 评论(0) 推荐(0)
摘要: 一:java代码实现动画1:旋转(Rotation)***************AnimationSet主要用来多个动画同时进行的时候用的*******************************************************AnimationSet animationSet=new AnimationSet(true);**********Animation.RELATIVE_TO_SELF,0.5f这两个参数是相对控件自己宽度一半的作为旋转中心的横坐标*************************************除了Animation.RELATIVE_ 阅读全文
posted @ 2012-09-24 15:24 言程序 阅读(286) 评论(0) 推荐(0)
摘要: <?xml version="1.0" encoding="UTF-8"?>-<shape android:shape="rectangle" xmlns:android="http://schemas.android.com/apk/res/android"> <!-- android:shape="" 表示是圆角矩形还是椭圆等等 --> <solid android:color="@color/green"/> <!- 阅读全文
posted @ 2012-09-24 14:27 言程序 阅读(150) 评论(0) 推荐(0)
摘要: 方法 inflate(int resource, ViewGroup root, boolean attachToRoot) 中,前连个参数都好理解,我比较费解的是第3个参数。1: 第一种情况显示checkBox: setContentView(R.layout.main);ViewGroupv= (ViewGroup)findViewById(R.id.ffff);Viewvv=LayoutInflater.from(this).inflate(R.layout.ffff,v);2:如果把代码改成这样 View vv = LayoutInflater.from(this).inflat... 阅读全文
posted @ 2012-09-24 14:08 言程序 阅读(1074) 评论(0) 推荐(0)
摘要: 子界面经常要传命令给主Activity,让主Activity来实行调用其他界面的功能,怎么完成,就看接口的使用:(1)首先在子界面定义接口,这里子界面是一个Fragment:public interface MeClickInterface { void meClick(); }(2)然后再Fragment实现接口的引用:private MeClickInterface mci;(3)定义方法,将导入的引用全局化(这一步很重要,如果没有这一步,实现接口的类和定义接口的类将不会相关联):public void setMeclick(final MeClickInterface mci){t... 阅读全文
posted @ 2012-09-24 12:10 言程序 阅读(187) 评论(0) 推荐(0)
摘要: 1:android:id如果要在代码或在XML布局文件中引用某个控件,该控件必须要设置android:id的属性-@id/value或者@+id/value。第一种格式中的value必须要在R.id类中存在,也就是说,要为当前控件指定一个在R.id类中已经存在的int类型变量作为其ID值,如果该变量不存在的话,XML布局文件无法验证通过。第二种在@和id之间多了一个加号,表示如果value指定的变量如果在R.id类中存在,则使用已经存在的变量值作为其ID值,否则将会在R.id类中新建一个int类型的变量并储存。2:android:layout_width和android:layout_heig 阅读全文
posted @ 2012-09-21 10:34 言程序 阅读(1456) 评论(0) 推荐(0)
摘要: public class HallListAdapter extends BaseAdapter { private LayoutInflater mInflater; DBController dbController=new DBController(); private TextView zero; private TextView title; private TextView cream; private Button ztime; private TextView zname; private View view; private TextView zpic; private Bu 阅读全文
posted @ 2012-09-20 18:00 言程序 阅读(891) 评论(0) 推荐(0)
摘要: public class MainActivity extends FragmentActivity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ***************FragmentTransaction对fragment进行添加,移除,替换,以及执行其他动作。*********************FragmentTransaction ft = getSuppor... 阅读全文
posted @ 2012-09-20 17:53 言程序 阅读(1937) 评论(0) 推荐(0)
摘要: android:background="@drawable/setting_item""@drawable/setting_item"内容:<?xml version="1.0" encoding="utf-8"?><selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@color/orange" android: 阅读全文
posted @ 2012-09-20 17:45 言程序 阅读(218) 评论(0) 推荐(0)
摘要: package com.example.shudu03;import android.os.Bundle;import android.app.Activity;import android.view.Menu;import android.view.MenuItem;import android.view.Window;import android.support.v4.app.NavUtils;public class MainActivity extends Activity { public void onCreate(Bundle savedInstanceState) { ... 阅读全文
posted @ 2012-09-18 14:35 言程序 阅读(1005) 评论(0) 推荐(0)