安卓论坛
标题:
ViewPageIndicator 和 ViewPager 仿各类新闻客户端却换效果
[打印本页]
作者:
admin
时间:
2016-8-28 12:04
标题:
ViewPageIndicator 和 ViewPager 仿各类新闻客户端却换效果
一:关于第三方控件下载地址
https://github.com/JakeWharton/Android-ViewPagerIndicator
,
二:使用方法
1:XML文件
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<com.viewpagerindicator.TabPageIndicator
android:id="@+id/indicator"
android:background="@drawable/base_action_bar_bg"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
/>
<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
/>
</LinearLayout>
复制代码
2:activity文件
容易出错的情况
这里要注意继承自
FragmentActivity 一般默认都是集成
AppCompatActivity 会导致错误
另外记得设置theme
常见错误:
欢迎光临 安卓论坛 (http://android.hh85.com/)
Powered by Discuz! X3.2