`
80245089
  • 浏览: 83834 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论
文章列表
String URL = "www.google.com"; Uri uri = Uri.parse(URL); Intent web = new Intent(Intent.ACTION_VIEW, uri); startActivity(web); 如果URL地址不是标准的地址,会导致异常. 如果地址前有空格(String URL = "  www.google.com") ,就会发生系统异常.
1.代码注册(不是常驻型广播,也就是说广播跟随程序的生命周期。) XXXActivity.this.registerReceiver(smsBroadCastReceiver, intentFilter);  2.配置文件注册(常驻型,也就是说当应用程序关闭后,如果有信息广播来,程序也会被系统调用自动运行。) <receiver android:name=".SmsBroadCastReceiver">              <intent-filter android:priority="20">          ...
1.<view         class="com.android.contacts.PinnedHeaderListView"         android:id="@android:id/list"         android:layout_width="match_parent"         android:layout_height="match_parent"         android:fastScrollEnabled="true"     /> &l ...
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);  //得到InputMethodManager的实例 if (imm.isActive()) { //如果开启 imm.toggleSoftInput(InputMethodManager.SHOW_IMPLICIT, InputMethodManager.HIDE_NOT_ALWAYS); //关闭软键盘,开启方法相同,这个方法是切换开启与关闭状态的 } - ...
1.选择菜单OptionsMenu   点击Menu key,显示选择菜单   实现方法.onCreateOptionsMenu()此方法只会调用一次,即第一次显示的时候会调用.   如果需要更新菜单项.可以在onPrepareOptionsMenu()方法中操作.   当菜单被选择的时候,在OnOptionsItemSelected()方法中实现. 2.上下文菜单ContextMenu   在view按2s,就会显示上下文菜单.onCreateContextMenu每次都会调用.选中的时候,在onContextItemSelected()方法中实现.
Dialog类中,如果调用setCancelable(false),那么按返回的key,就不会关闭弹出窗口. mCancelable默认是true;
关于android:clearTaskOnLaunch使用测试,有两种情况 Activity A(启动界面.android:clearTaskOnLaunch = true) Activity B 启动A后,再点击按钮启动B,点击home键,返回到home screen a.长按home键,在recent中点击应该图标,显示B界面 b.再点击应用图标,显示A界面
arity-2.1.2.jar.

ViewStub标签

1.ViewStub标签类似include标签,导入布局文件.加载ViewStub的时候,其指定的布局不会被加载到内存中.只有在代码中调用 inflater().才会显示指定的布局.并且调用inflater以后,布局对象中就不存在ViewStub ViewStub viewStub = (ViewStub)findViewById(R.id.view_stub_id); viewStub.inflate();
第一层是DecorView(继承FrameLayout),整个屏幕(包括状态栏,标题栏以及剩余部分)     由系统创建.类路径:com.android.internal.policy.impl.PhoneWindow$DecorView 第二层LinearLayout,布局中包括两个Framelayout.第一个布局用于显示标题栏,第二个FrameLayout布局中显示就是我们自定义的布局文件. 附件中画黑色边框的布局是由系统生成.

Service生命周期

通过以下两种方式启动服务: 如果打算采用Context.startService()方法启动服务,在服务未被创建时,系统会先调用服务的onCreate()方法,接着调用onStart()方法。如果调用startService()方法前服务已经被创建,多次调用startService()方法并不会导致多次创建服务,但会导致多次调用onStart()方法。采用startService()方法启动的服务,只能调用Context.stopService()方法结束服务,服务结束时会调用onDestroy()方法。 如果打算采用Context.bindService()方法启动服务,在服务未被创建时 ...
INotificationManager interface INotificationManager {     void enqueueNotification(String pkg, int id, in Notification notification, inout int[] idReceived);     void cancelNotification(String pkg, int id);     void cancelAllNotifications(String pkg);     void enqueueToast(String pkg, ITransientN ...
设置快速滚动属性很容易,只需在布局的xml文件里设置属性即可:         <!-- 稿件列表 -->         <ListView android:id="@+id/main_newslist"                 android:layout_width="fill_parent"                 android:layout_height="fill_parent"                 android:background="@color/white ...
WindowManager mWm = (WindowManager)getSystemService(Context.WINDOW_SERVICE);         Button view = new Button(this);         view.setText("window manager test!");         WindowManager.LayoutParams mParams = new WindowManager.LayoutParams();         mWm.addView(view, mParams);
1.Context的实现类:android.app.ContextImpl 2.Window的实现类:com.android.internal.policy.implMidWindow 3.LayoutInflater的实现类:com.android.internal.policy.impl.MidLayoutInflater
Global site tag (gtag.js) - Google Analytics