Android Development Note-02

输入框左侧的logo:android:drawableleft

 
弹出提示:
Toast.makeText(this,"提示",Toast.LENGHT_LONG).show();
 
返回键退出:
onKeyDown(keyCode,event){
  if(keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount == 0){
//退出
return true;
}
return super.onKeyDown(keyCode,event);
}
 
注意事项:
1、测试类:继承AndroidTestCase类
方法要用test开头!!例如testCreate()、testSave()。
要在Mainfest.xml配置
在<application>内
<uses-library android:name="android.test.runner"/>
//name是默认的!
在<application>外
<instrumentation android:name="android.test.InstrumentationTestRunner"
android:targetPackage="com.ghimtim.firstapp"></instrumentation>
//name是默认的;targetPackage是MainActivty.java所在的包?
 
2、R.java不会自动生成的原因:mainfest.xml中存在错误!
 
3、新建Acivity时一定要在Mainfest.xml里面注册!!!
原文地址:https://www.cnblogs.com/ghimtim/p/4739579.html