1、假使AActivity已经启动(对应的启动Intent为intent1),此时调用startActivity(intent2)再次启动AActivity,在onResume()中调用getIntent()获取到的Intent仍然是intent1,除非重写onNewIntent()方法:
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
setIntent(intent);
}
2、ViewPager的子控件个数(getChildCount())最多为3(默认setOffscreenPageLimit(1),在destroyItem()中调用了removeView()),如果要获取ViewPager某个子页面,千万不能使用getChildAt(position),会造成数组越界。可以通过来获取:
@Override
public Object instantiateItem(ViewGroup container, int position) {
view.setTag(DEFAULT_TAG + position);
container.addView(view);
return view;
}
View child = mViewPager.findViewWithTag(DEFAULT_TAG + position));
3、自定义View为内部类时,如果需要在xml文件中使用,该View必须为静态内部类,当然这不是重点,重点是xml中必须使用view作为节点:
<view
android:layout_width="match_parent"
android:layout_height="wrap_content"
class="com.example.dialog.MyDialog$MyView" />
4、使用属性动画(Property Animation)中的位移类动画时,对layout根节点的控件(ll_outer)无效:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/ll_outer"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<LinearLayout
android:id="@+id/ll_inner"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
</LinearLayout>
</LinearLayout>
5、使用hide()与show()来切换Fragment时,Fragment的生命周期方法都不会被调用,除了onHiddenChanged()。