diff --git a/res/layout/auto_scroll_view_pager_demo.xml b/res/layout/auto_scroll_view_pager_demo.xml index f40bb00..34f3a74 100644 --- a/res/layout/auto_scroll_view_pager_demo.xml +++ b/res/layout/auto_scroll_view_pager_demo.xml @@ -7,6 +7,7 @@ android:id="@+id/auto_scroll_view_pager_inner" android:layout_width="match_parent" android:layout_height="wrap_content" + android:layout_marginTop="@dimen/dp_20" android:layout_marginBottom="@dimen/dp_40" android:text="@string/auto_scroll_view_pager_inner" /> diff --git a/res/layout/auto_scroll_view_pager_inner_fragment_demo.xml b/res/layout/auto_scroll_view_pager_inner_fragment_demo.xml index c40ad07..7176a60 100644 --- a/res/layout/auto_scroll_view_pager_inner_fragment_demo.xml +++ b/res/layout/auto_scroll_view_pager_inner_fragment_demo.xml @@ -6,7 +6,8 @@ + android:layout_height="@dimen/view_pager_height" + android:layout_marginTop="@dimen/dp_40" /> 下载中 文件将下载到: - 单个ViewPager - ViewPager嵌套 + ViewPager嵌套示例 更新于:  diff --git a/res/values-zh-rTW/strings.xml b/res/values-zh-rTW/strings.xml index 1a5221d..5ee49bb 100644 --- a/res/values-zh-rTW/strings.xml +++ b/res/values-zh-rTW/strings.xml @@ -41,8 +41,7 @@ 下載中 文件將下載到: - 單個ViewPager - ViewPager嵌套 + ViewPager嵌套示例 更新于:  diff --git a/res/values/strings.xml b/res/values/strings.xml index 765354a..be15b1a 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -59,8 +59,7 @@ downloading file will be saved to sdcard, the path is: - Single ViewPager - ViewPager in ViewPager + ViewPager in ViewPager Demo updated at:  GitHub diff --git a/src/cn/trinea/android/demo/AutoScrollViewPagerInnerDemo.java b/src/cn/trinea/android/demo/AutoScrollViewPagerInnerDemo.java index 3f7e97a..5651c4a 100644 --- a/src/cn/trinea/android/demo/AutoScrollViewPagerInnerDemo.java +++ b/src/cn/trinea/android/demo/AutoScrollViewPagerInnerDemo.java @@ -26,6 +26,8 @@ public class AutoScrollViewPagerInnerDemo extends BaseFragmentActivity { public static final String EXTRA_INDEX = "index"; public static final String EXTRA_TITLE = "title"; + static final int DEFAULT_INDEX = 1; + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState, R.layout.view_pager_demo); @@ -45,9 +47,7 @@ protected void onCreate(Bundle savedInstanceState) { viewPager.setAdapter(new myPagerAdapter(getSupportFragmentManager(), fragmentList, titleList)); viewPager.setOnPageChangeListener(new MyOnPageChangeListener()); - int defaultPosition = 1; - viewPager.setCurrentItem(defaultPosition); - sendSelectedBroadcast(defaultPosition); + viewPager.setCurrentItem(DEFAULT_INDEX); } /** diff --git a/src/cn/trinea/android/demo/ImagePagerFragment.java b/src/cn/trinea/android/demo/ImagePagerFragment.java index b183130..3f1d861 100644 --- a/src/cn/trinea/android/demo/ImagePagerFragment.java +++ b/src/cn/trinea/android/demo/ImagePagerFragment.java @@ -54,6 +54,9 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa Bundle bundle = getArguments(); if (bundle != null) { index = bundle.getInt(AutoScrollViewPagerInnerDemo.EXTRA_INDEX); + if (index == AutoScrollViewPagerInnerDemo.DEFAULT_INDEX) { + viewPager.startAutoScroll(); + } } return v;