├── app ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── mipmap-hdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── values │ │ │ │ ├── colors.xml │ │ │ │ ├── dimens.xml │ │ │ │ ├── styles.xml │ │ │ │ └── strings.xml │ │ │ ├── values-w820dp │ │ │ │ └── dimens.xml │ │ │ └── layout │ │ │ │ ├── viewpager_indicator.xml │ │ │ │ └── activity_main.xml │ │ ├── java │ │ │ └── shanyao │ │ │ │ └── tabpagerindicatordemo │ │ │ │ ├── ShanYaoApplication.java │ │ │ │ ├── fragment │ │ │ │ ├── AFragment.java │ │ │ │ ├── BFragment.java │ │ │ │ ├── CFragment.java │ │ │ │ ├── DFragment.java │ │ │ │ ├── EFragment.java │ │ │ │ ├── FFragment.java │ │ │ │ ├── GFragment.java │ │ │ │ ├── HFragment.java │ │ │ │ ├── IFragment.java │ │ │ │ ├── JFragment.java │ │ │ │ ├── KFragment.java │ │ │ │ ├── LFragment.java │ │ │ │ ├── MFragment.java │ │ │ │ └── NFragment.java │ │ │ │ ├── activity │ │ │ │ ├── MainActivity.java │ │ │ │ ├── WeightNoExpandSame.java │ │ │ │ ├── NoWeightExpandNoSame.java │ │ │ │ ├── NoWeightExpandSame.java │ │ │ │ ├── NoWeightNoExpandSame.java │ │ │ │ ├── WeightNoExpandNoSame.java │ │ │ │ └── NoWeightNoExpandNoSame.java │ │ │ │ ├── utils │ │ │ │ └── CommonUtils.java │ │ │ │ └── FragmentFactory.java │ │ └── AndroidManifest.xml │ ├── test │ │ └── java │ │ │ └── shanyao │ │ │ └── tabpagerindicatordemo │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── shanyao │ │ └── tabpagerindicatordemo │ │ └── ApplicationTest.java ├── proguard-rules.pro └── build.gradle ├── .idea ├── .name ├── copyright │ └── profiles_settings.xml ├── encodings.xml ├── vcs.xml ├── modules.xml ├── runConfigurations.xml ├── compiler.xml ├── gradle.xml └── misc.xml ├── tabpagerindictor ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ └── values │ │ │ │ ├── strings.xml │ │ │ │ └── attrs.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ │ └── shanyao │ │ │ └── tabpagerindictor │ │ │ └── TabPageIndicator.java │ ├── test │ │ └── java │ │ │ └── shanyao │ │ │ └── tabpagerindictor │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── shanyao │ │ └── tabpagerindictor │ │ └── ApplicationTest.java ├── build.gradle └── proguard-rules.pro ├── settings.gradle ├── gif ├── 1.gif ├── 2.gif ├── 3.gif ├── 4.gif ├── 5.gif └── 6.gif ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .gitignore ├── gradle.properties ├── gradlew.bat ├── README.md └── gradlew /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /.idea/.name: -------------------------------------------------------------------------------- 1 | TabPagerIndicatorDemo -------------------------------------------------------------------------------- /tabpagerindictor/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app', ':tabpagerindictor' 2 | -------------------------------------------------------------------------------- /gif/1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shanyao0/TabPagerIndicatorDemo/HEAD/gif/1.gif -------------------------------------------------------------------------------- /gif/2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shanyao0/TabPagerIndicatorDemo/HEAD/gif/2.gif -------------------------------------------------------------------------------- /gif/3.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shanyao0/TabPagerIndicatorDemo/HEAD/gif/3.gif -------------------------------------------------------------------------------- /gif/4.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shanyao0/TabPagerIndicatorDemo/HEAD/gif/4.gif -------------------------------------------------------------------------------- /gif/5.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shanyao0/TabPagerIndicatorDemo/HEAD/gif/5.gif -------------------------------------------------------------------------------- /gif/6.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shanyao0/TabPagerIndicatorDemo/HEAD/gif/6.gif -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shanyao0/TabPagerIndicatorDemo/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | -------------------------------------------------------------------------------- /tabpagerindictor/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | TabPagerIndictor 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shanyao0/TabPagerIndicatorDemo/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shanyao0/TabPagerIndicatorDemo/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shanyao0/TabPagerIndicatorDemo/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shanyao0/TabPagerIndicatorDemo/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shanyao0/TabPagerIndicatorDemo/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Dec 28 10:00:20 PST 2015 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip 7 | -------------------------------------------------------------------------------- /tabpagerindictor/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /app/src/test/java/shanyao/tabpagerindicatordemo/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package shanyao.tabpagerindicatordemo; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * To work on unit tests, switch the Test Artifact in the Build Variants view. 9 | */ 10 | public class ExampleUnitTest { 11 | @Test 12 | public void addition_isCorrect() throws Exception { 13 | assertEquals(4, 2 + 2); 14 | } 15 | } -------------------------------------------------------------------------------- /tabpagerindictor/src/test/java/shanyao/tabpagerindictor/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package shanyao.tabpagerindictor; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * To work on unit tests, switch the Test Artifact in the Build Variants view. 9 | */ 10 | public class ExampleUnitTest { 11 | @Test 12 | public void addition_isCorrect() throws Exception { 13 | assertEquals(4, 2 + 2); 14 | } 15 | } -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/androidTest/java/shanyao/tabpagerindicatordemo/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package shanyao.tabpagerindicatordemo; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /tabpagerindictor/src/androidTest/java/shanyao/tabpagerindictor/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package shanyao.tabpagerindictor; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /app/src/main/java/shanyao/tabpagerindicatordemo/ShanYaoApplication.java: -------------------------------------------------------------------------------- 1 | package shanyao.tabpagerindicatordemo; 2 | 3 | import android.app.Application; 4 | import android.content.Context; 5 | 6 | public class ShanYaoApplication extends Application { 7 | private static Context mContext; 8 | @Override 9 | public void onCreate() { 10 | super.onCreate(); 11 | mContext = this; 12 | } 13 | 14 | /** 15 | * 获取全局的context 16 | */ 17 | public static Context getContext() { 18 | return mContext; 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | TabPagerIndicatorDemo 3 | 4 | 全部订单 5 | 当前订单 6 | 历史订单 7 | 8 | 9 | 头条 10 | 娱乐 11 | 体育 12 | 网易号 13 | 北京 14 | 财经 15 | 科技 16 | 汽车 17 | 时尚 18 | 图片 19 | 跟帖 20 | 21 | 22 | -------------------------------------------------------------------------------- /tabpagerindictor/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion 23 5 | buildToolsVersion "23.0.3" 6 | 7 | defaultConfig { 8 | minSdkVersion 15 9 | targetSdkVersion 23 10 | versionCode 1 11 | versionName "1.0" 12 | } 13 | buildTypes { 14 | release { 15 | minifyEnabled false 16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 17 | } 18 | } 19 | } 20 | 21 | dependencies { 22 | compile fileTree(dir: 'libs', include: ['*.jar']) 23 | testCompile 'junit:junit:4.12' 24 | compile 'com.android.support:appcompat-v7:23.2.1' 25 | } 26 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in D:\program\sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /tabpagerindictor/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in D:\program\sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /app/src/main/res/layout/viewpager_indicator.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 13 | 18 | 19 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 23 5 | buildToolsVersion "23.0.3" 6 | 7 | defaultConfig { 8 | applicationId "shanyao.tabpagerindicatordemo" 9 | minSdkVersion 15 10 | targetSdkVersion 23 11 | versionCode 1 12 | versionName "1.0" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | dependencies { 23 | compile fileTree(include: ['*.jar'], dir: 'libs') 24 | testCompile 'junit:junit:4.12' 25 | compile 'com.android.support:appcompat-v7:23.2.1' 26 | compile project(':tabpagerindictor') 27 | } 28 | -------------------------------------------------------------------------------- /tabpagerindictor/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 24 | 25 | -------------------------------------------------------------------------------- /app/src/main/java/shanyao/tabpagerindicatordemo/fragment/AFragment.java: -------------------------------------------------------------------------------- 1 | package shanyao.tabpagerindicatordemo.fragment; 2 | 3 | import android.graphics.Color; 4 | import android.os.Bundle; 5 | import android.support.annotation.Nullable; 6 | import android.support.v4.app.Fragment; 7 | import android.view.Gravity; 8 | import android.view.LayoutInflater; 9 | import android.view.View; 10 | import android.view.ViewGroup; 11 | import android.widget.TextView; 12 | 13 | /** 14 | * Created by shaoyao on 2016/6/17. 15 | */ 16 | public class AFragment extends Fragment { 17 | @Nullable 18 | @Override 19 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 20 | TextView view = new TextView(getActivity()); 21 | view.setGravity(Gravity.CENTER); 22 | view.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); 23 | view.setText("全部订单"); 24 | view.setTextColor(Color.RED); 25 | view.setTextSize(50); 26 | return view; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /app/src/main/java/shanyao/tabpagerindicatordemo/fragment/BFragment.java: -------------------------------------------------------------------------------- 1 | package shanyao.tabpagerindicatordemo.fragment; 2 | 3 | import android.graphics.Color; 4 | import android.os.Bundle; 5 | import android.support.annotation.Nullable; 6 | import android.support.v4.app.Fragment; 7 | import android.view.Gravity; 8 | import android.view.LayoutInflater; 9 | import android.view.View; 10 | import android.view.ViewGroup; 11 | import android.widget.TextView; 12 | 13 | /** 14 | * Created by shanyao on 2016/6/17. 15 | */ 16 | public class BFragment extends Fragment { 17 | @Nullable 18 | @Override 19 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 20 | TextView view = new TextView(getActivity()); 21 | view.setGravity(Gravity.CENTER); 22 | view.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); 23 | view.setText("当前订单"); 24 | view.setTextColor(Color.RED); 25 | view.setTextSize(50); 26 | return view; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /app/src/main/java/shanyao/tabpagerindicatordemo/fragment/CFragment.java: -------------------------------------------------------------------------------- 1 | package shanyao.tabpagerindicatordemo.fragment; 2 | 3 | import android.graphics.Color; 4 | import android.os.Bundle; 5 | import android.support.annotation.Nullable; 6 | import android.support.v4.app.Fragment; 7 | import android.view.Gravity; 8 | import android.view.LayoutInflater; 9 | import android.view.View; 10 | import android.view.ViewGroup; 11 | import android.widget.TextView; 12 | 13 | /** 14 | * Created by shanyao on 2016/6/17. 15 | */ 16 | public class CFragment extends Fragment { 17 | @Nullable 18 | @Override 19 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 20 | TextView view = new TextView(getActivity()); 21 | view.setGravity(Gravity.CENTER); 22 | view.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); 23 | view.setText("历史订单"); 24 | view.setTextColor(Color.RED); 25 | view.setTextSize(50); 26 | return view; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /app/src/main/java/shanyao/tabpagerindicatordemo/fragment/DFragment.java: -------------------------------------------------------------------------------- 1 | package shanyao.tabpagerindicatordemo.fragment; 2 | 3 | import android.graphics.Color; 4 | import android.os.Bundle; 5 | import android.support.annotation.Nullable; 6 | import android.support.v4.app.Fragment; 7 | import android.view.Gravity; 8 | import android.view.LayoutInflater; 9 | import android.view.View; 10 | import android.view.ViewGroup; 11 | import android.widget.TextView; 12 | 13 | /** 14 | * Created by shanyao on 2016/6/17. 15 | */ 16 | public class DFragment extends Fragment { 17 | @Nullable 18 | @Override 19 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 20 | TextView view = new TextView(getActivity()); 21 | view.setGravity(Gravity.CENTER); 22 | view.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); 23 | view.setText("头条"); 24 | view.setTextColor(Color.RED); 25 | view.setTextSize(50); 26 | return view; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /app/src/main/java/shanyao/tabpagerindicatordemo/fragment/EFragment.java: -------------------------------------------------------------------------------- 1 | package shanyao.tabpagerindicatordemo.fragment; 2 | 3 | import android.graphics.Color; 4 | import android.os.Bundle; 5 | import android.support.annotation.Nullable; 6 | import android.support.v4.app.Fragment; 7 | import android.view.Gravity; 8 | import android.view.LayoutInflater; 9 | import android.view.View; 10 | import android.view.ViewGroup; 11 | import android.widget.TextView; 12 | 13 | /** 14 | * Created by shanyao on 2016/6/17. 15 | */ 16 | public class EFragment extends Fragment { 17 | @Nullable 18 | @Override 19 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 20 | TextView view = new TextView(getActivity()); 21 | view.setGravity(Gravity.CENTER); 22 | view.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); 23 | view.setText("娱乐"); 24 | view.setTextColor(Color.RED); 25 | view.setTextSize(50); 26 | return view; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /app/src/main/java/shanyao/tabpagerindicatordemo/fragment/FFragment.java: -------------------------------------------------------------------------------- 1 | package shanyao.tabpagerindicatordemo.fragment; 2 | 3 | import android.graphics.Color; 4 | import android.os.Bundle; 5 | import android.support.annotation.Nullable; 6 | import android.support.v4.app.Fragment; 7 | import android.view.Gravity; 8 | import android.view.LayoutInflater; 9 | import android.view.View; 10 | import android.view.ViewGroup; 11 | import android.widget.TextView; 12 | 13 | /** 14 | * Created by shanyao on 2016/6/17. 15 | */ 16 | public class FFragment extends Fragment { 17 | @Nullable 18 | @Override 19 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 20 | TextView view = new TextView(getActivity()); 21 | view.setGravity(Gravity.CENTER); 22 | view.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); 23 | view.setText("体育"); 24 | view.setTextColor(Color.RED); 25 | view.setTextSize(50); 26 | return view; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /app/src/main/java/shanyao/tabpagerindicatordemo/fragment/GFragment.java: -------------------------------------------------------------------------------- 1 | package shanyao.tabpagerindicatordemo.fragment; 2 | 3 | import android.graphics.Color; 4 | import android.os.Bundle; 5 | import android.support.annotation.Nullable; 6 | import android.support.v4.app.Fragment; 7 | import android.view.Gravity; 8 | import android.view.LayoutInflater; 9 | import android.view.View; 10 | import android.view.ViewGroup; 11 | import android.widget.TextView; 12 | 13 | /** 14 | * Created by shanyao on 2016/6/17. 15 | */ 16 | public class GFragment extends Fragment { 17 | @Nullable 18 | @Override 19 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 20 | TextView view = new TextView(getActivity()); 21 | view.setGravity(Gravity.CENTER); 22 | view.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); 23 | view.setText("网易号"); 24 | view.setTextColor(Color.RED); 25 | view.setTextSize(50); 26 | return view; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /app/src/main/java/shanyao/tabpagerindicatordemo/fragment/HFragment.java: -------------------------------------------------------------------------------- 1 | package shanyao.tabpagerindicatordemo.fragment; 2 | 3 | import android.graphics.Color; 4 | import android.os.Bundle; 5 | import android.support.annotation.Nullable; 6 | import android.support.v4.app.Fragment; 7 | import android.view.Gravity; 8 | import android.view.LayoutInflater; 9 | import android.view.View; 10 | import android.view.ViewGroup; 11 | import android.widget.TextView; 12 | 13 | /** 14 | * Created by shanyao on 2016/6/17. 15 | */ 16 | public class HFragment extends Fragment { 17 | @Nullable 18 | @Override 19 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 20 | TextView view = new TextView(getActivity()); 21 | view.setGravity(Gravity.CENTER); 22 | view.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); 23 | view.setText("北京"); 24 | view.setTextColor(Color.RED); 25 | view.setTextSize(50); 26 | return view; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /app/src/main/java/shanyao/tabpagerindicatordemo/fragment/IFragment.java: -------------------------------------------------------------------------------- 1 | package shanyao.tabpagerindicatordemo.fragment; 2 | 3 | import android.graphics.Color; 4 | import android.os.Bundle; 5 | import android.support.annotation.Nullable; 6 | import android.support.v4.app.Fragment; 7 | import android.view.Gravity; 8 | import android.view.LayoutInflater; 9 | import android.view.View; 10 | import android.view.ViewGroup; 11 | import android.widget.TextView; 12 | 13 | /** 14 | * Created by shanyao on 2016/6/17. 15 | */ 16 | public class IFragment extends Fragment { 17 | @Nullable 18 | @Override 19 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 20 | TextView view = new TextView(getActivity()); 21 | view.setGravity(Gravity.CENTER); 22 | view.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); 23 | view.setText("财经"); 24 | view.setTextColor(Color.RED); 25 | view.setTextSize(50); 26 | return view; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /app/src/main/java/shanyao/tabpagerindicatordemo/fragment/JFragment.java: -------------------------------------------------------------------------------- 1 | package shanyao.tabpagerindicatordemo.fragment; 2 | 3 | import android.graphics.Color; 4 | import android.os.Bundle; 5 | import android.support.annotation.Nullable; 6 | import android.support.v4.app.Fragment; 7 | import android.view.Gravity; 8 | import android.view.LayoutInflater; 9 | import android.view.View; 10 | import android.view.ViewGroup; 11 | import android.widget.TextView; 12 | 13 | /** 14 | * Created by shanyao on 2016/6/17. 15 | */ 16 | public class JFragment extends Fragment { 17 | @Nullable 18 | @Override 19 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 20 | TextView view = new TextView(getActivity()); 21 | view.setGravity(Gravity.CENTER); 22 | view.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); 23 | view.setText("科技"); 24 | view.setTextColor(Color.RED); 25 | view.setTextSize(50); 26 | return view; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /app/src/main/java/shanyao/tabpagerindicatordemo/fragment/KFragment.java: -------------------------------------------------------------------------------- 1 | package shanyao.tabpagerindicatordemo.fragment; 2 | 3 | import android.graphics.Color; 4 | import android.os.Bundle; 5 | import android.support.annotation.Nullable; 6 | import android.support.v4.app.Fragment; 7 | import android.view.Gravity; 8 | import android.view.LayoutInflater; 9 | import android.view.View; 10 | import android.view.ViewGroup; 11 | import android.widget.TextView; 12 | 13 | /** 14 | * Created by shanyao on 2016/6/17. 15 | */ 16 | public class KFragment extends Fragment { 17 | @Nullable 18 | @Override 19 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 20 | TextView view = new TextView(getActivity()); 21 | view.setGravity(Gravity.CENTER); 22 | view.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); 23 | view.setText("汽车"); 24 | view.setTextColor(Color.RED); 25 | view.setTextSize(50); 26 | return view; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /app/src/main/java/shanyao/tabpagerindicatordemo/fragment/LFragment.java: -------------------------------------------------------------------------------- 1 | package shanyao.tabpagerindicatordemo.fragment; 2 | 3 | import android.graphics.Color; 4 | import android.os.Bundle; 5 | import android.support.annotation.Nullable; 6 | import android.support.v4.app.Fragment; 7 | import android.view.Gravity; 8 | import android.view.LayoutInflater; 9 | import android.view.View; 10 | import android.view.ViewGroup; 11 | import android.widget.TextView; 12 | 13 | /** 14 | * Created by shanyao on 2016/6/17. 15 | */ 16 | public class LFragment extends Fragment { 17 | @Nullable 18 | @Override 19 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 20 | TextView view = new TextView(getActivity()); 21 | view.setGravity(Gravity.CENTER); 22 | view.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); 23 | view.setText("时尚"); 24 | view.setTextColor(Color.RED); 25 | view.setTextSize(50); 26 | return view; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /app/src/main/java/shanyao/tabpagerindicatordemo/fragment/MFragment.java: -------------------------------------------------------------------------------- 1 | package shanyao.tabpagerindicatordemo.fragment; 2 | 3 | import android.graphics.Color; 4 | import android.os.Bundle; 5 | import android.support.annotation.Nullable; 6 | import android.support.v4.app.Fragment; 7 | import android.view.Gravity; 8 | import android.view.LayoutInflater; 9 | import android.view.View; 10 | import android.view.ViewGroup; 11 | import android.widget.TextView; 12 | 13 | /** 14 | * Created by shanyao on 2016/6/17. 15 | */ 16 | public class MFragment extends Fragment { 17 | @Nullable 18 | @Override 19 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 20 | TextView view = new TextView(getActivity()); 21 | view.setGravity(Gravity.CENTER); 22 | view.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); 23 | view.setText("图片"); 24 | view.setTextColor(Color.RED); 25 | view.setTextSize(50); 26 | return view; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /app/src/main/java/shanyao/tabpagerindicatordemo/fragment/NFragment.java: -------------------------------------------------------------------------------- 1 | package shanyao.tabpagerindicatordemo.fragment; 2 | 3 | import android.graphics.Color; 4 | import android.os.Bundle; 5 | import android.support.annotation.Nullable; 6 | import android.support.v4.app.Fragment; 7 | import android.view.Gravity; 8 | import android.view.LayoutInflater; 9 | import android.view.View; 10 | import android.view.ViewGroup; 11 | import android.widget.TextView; 12 | 13 | /** 14 | * Created by shanyao on 2016/6/17. 15 | */ 16 | public class NFragment extends Fragment { 17 | @Nullable 18 | @Override 19 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 20 | TextView view = new TextView(getActivity()); 21 | view.setGravity(Gravity.CENTER); 22 | view.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); 23 | view.setText("跟帖"); 24 | view.setTextColor(Color.RED); 25 | view.setTextSize(50); 26 | return view; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 |