框架代码

main
刘骐瑞 4 months ago
parent d9987feb8c
commit ddbf53d412

@ -0,0 +1,8 @@
*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures

@ -0,0 +1 @@
LLRiseTabBarDemo

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AndroidProjectSystem">
<option name="providerId" value="com.android.tools.idea.GradleProjectSystem" />
</component>
</project>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="21" />
</component>
</project>

@ -0,0 +1,3 @@
<component name="CopyrightManager">
<settings default="" />
</component>

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="deploymentTargetSelector">
<selectionStates>
<SelectionState runConfigName="app">
<option name="selectionMode" value="DROPDOWN" />
<DropdownSelection timestamp="2025-10-11T11:49:33.560456900Z">
<Target type="DEFAULT_BOOT">
<handle>
<DeviceId pluginId="LocalEmulator" identifier="path=C:\Users\asus\.android\avd\Pixel.avd" />
</handle>
</Target>
</DropdownSelection>
<DialogSelection />
</SelectionState>
</selectionStates>
</component>
</project>

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DeviceTable">
<option name="columnSorters">
<list>
<ColumnSorterState>
<option name="column" value="Name" />
<option name="order" value="ASCENDING" />
</ColumnSorterState>
</list>
</option>
</component>
</project>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="PROJECT" charset="UTF-8" />
</component>
</project>

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="testRunner" value="CHOOSE_PER_TEST" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleJvm" value="#GRADLE_LOCAL_JAVA_HOME" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
<option value="$PROJECT_DIR$/mainnavigatetabbar" />
</set>
</option>
</GradleProjectSettings>
</option>
</component>
</project>

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectMigrations">
<option name="MigrateToGradleLocalJavaHome">
<set>
<option value="$PROJECT_DIR$" />
</set>
</option>
</component>
</project>

@ -0,0 +1,201 @@
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="NullableNotNullManager">
<option name="myDefaultNullable" value="android.support.annotation.Nullable" />
<option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
<option name="myNullables">
<value>
<list size="14">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
<item index="4" class="java.lang.String" itemvalue="org.jspecify.annotations.Nullable" />
<item index="5" class="java.lang.String" itemvalue="com.android.annotations.Nullable" />
<item index="6" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNullable" />
<item index="7" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NullableDecl" />
<item index="8" class="java.lang.String" itemvalue="androidx.annotation.Nullable" />
<item index="9" class="java.lang.String" itemvalue="org.eclipse.jdt.annotation.Nullable" />
<item index="10" class="java.lang.String" itemvalue="jakarta.annotation.Nullable" />
<item index="11" class="java.lang.String" itemvalue="javax.annotation.CheckForNull" />
<item index="12" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.qual.Nullable" />
<item index="13" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NullableType" />
</list>
</value>
</option>
<option name="myNotNulls">
<value>
<list size="13">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
<item index="4" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNonNull" />
<item index="5" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.qual.NonNull" />
<item index="6" class="java.lang.String" itemvalue="org.jspecify.annotations.NonNull" />
<item index="7" class="java.lang.String" itemvalue="jakarta.annotation.Nonnull" />
<item index="8" class="java.lang.String" itemvalue="androidx.annotation.NonNull" />
<item index="9" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NonNullType" />
<item index="10" class="java.lang.String" itemvalue="com.android.annotations.NonNull" />
<item index="11" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NonNullDecl" />
<item index="12" class="java.lang.String" itemvalue="org.eclipse.jdt.annotation.NonNull" />
</list>
</value>
</option>
</component>
<component name="ProjectInspectionProfilesVisibleTreeState">
<entry key="Project Default">
<profile-state>
<expanded-state>
<State>
<id />
</State>
<State>
<id>Android</id>
</State>
<State>
<id>Android Lint</id>
</State>
<State>
<id>Code style issuesJava</id>
</State>
<State>
<id>Control FlowGroovy</id>
</State>
<State>
<id>Control flow issuesJava</id>
</State>
<State>
<id>Declaration redundancyJava</id>
</State>
<State>
<id>Error handlingGroovy</id>
</State>
<State>
<id>Error handlingJava</id>
</State>
<State>
<id>Finalization issuesJava</id>
</State>
<State>
<id>General</id>
</State>
<State>
<id>Google Cloud Endpoints</id>
</State>
<State>
<id>Groovy</id>
</State>
<State>
<id>ImportsJava</id>
</State>
<State>
<id>Inheritance issuesJava</id>
</State>
<State>
<id>Initialization issuesJava</id>
</State>
<State>
<id>J2ME issuesJava</id>
</State>
<State>
<id>JUnit issuesJava</id>
</State>
<State>
<id>Java</id>
</State>
<State>
<id>Java language level issuesJava</id>
</State>
<State>
<id>Java language level migration aidsJava</id>
</State>
<State>
<id>JavaFX</id>
</State>
<State>
<id>Language Injection</id>
</State>
<State>
<id>Maven</id>
</State>
<State>
<id>Memory issuesJava</id>
</State>
<State>
<id>Naming conventionsJava</id>
</State>
<State>
<id>Numeric issuesJava</id>
</State>
<State>
<id>Pattern Validation</id>
</State>
<State>
<id>Performance issuesJava</id>
</State>
<State>
<id>Portability issuesJava</id>
</State>
<State>
<id>Probable bugsGroovy</id>
</State>
<State>
<id>Probable bugsJava</id>
</State>
<State>
<id>Properties FilesJava</id>
</State>
<State>
<id>Serialization issuesJava</id>
</State>
<State>
<id>Threading issuesGroovy</id>
</State>
<State>
<id>Threading issuesJava</id>
</State>
<State>
<id>Validity issuesGroovy</id>
</State>
<State>
<id>Visibility issuesJava</id>
</State>
<State>
<id>XML</id>
</State>
<State>
<id>toString() issuesJava</id>
</State>
</expanded-state>
<selected-state>
<State>
<id>AndroidLintUseCompoundDrawables</id>
</State>
</selected-state>
</profile-state>
</entry>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="jbr-21" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
<component name="masterDetails">
<states>
<state key="ProjectJDKs.UI">
<settings>
<last-edited>1.8</last-edited>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
</states>
</component>
</project>

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/LLRiseTabBarDemo.iml" filepath="$PROJECT_DIR$/.idea/LLRiseTabBarDemo.iml" />
</modules>
</component>
</project>

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="com.intellij.execution.junit.AbstractAllInDirectoryConfigurationProducer" />
<option value="com.intellij.execution.junit.AllInPackageConfigurationProducer" />
<option value="com.intellij.execution.junit.PatternConfigurationProducer" />
<option value="com.intellij.execution.junit.TestInClassConfigurationProducer" />
<option value="com.intellij.execution.junit.UniqueIdConfigurationProducer" />
<option value="com.intellij.execution.junit.testDiscovery.JUnitTestDiscoveryConfigurationProducer" />
<option value="org.jetbrains.kotlin.idea.junit.KotlinJUnitRunConfigurationProducer" />
<option value="org.jetbrains.kotlin.idea.junit.KotlinPatternConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
</set>
</option>
</component>
</project>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
</component>
</project>

@ -0,0 +1,28 @@
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.startsmake.llrisetabbardemo"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
namespace "com.startsmake.llrisetabbardemo"
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
testImplementation 'junit:junit:4.12'
implementation 'com.android.support:appcompat-v7:23.1.0'
implementation project(':mainnavigatetabbar')
}

@ -0,0 +1,17 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /Users/shine/Library/Android/sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

@ -0,0 +1,13 @@
package com.startsmake.llrisetabbardemo;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
}

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".activity.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
</manifest>

@ -0,0 +1,53 @@
package com.startsmake.llrisetabbardemo.activity;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Toast;
import com.startsmake.llrisetabbardemo.R;
import com.startsmake.llrisetabbardemo.fragment.CityFragment;
import com.startsmake.llrisetabbardemo.fragment.HomeFragment;
import com.startsmake.llrisetabbardemo.fragment.MessageFragment;
import com.startsmake.llrisetabbardemo.fragment.PersonFragment;
import com.startsmake.mainnavigatetabbar.widget.MainNavigateTabBar;
public class MainActivity extends AppCompatActivity {
private static final String TAG_PAGE_HOME = "首页";
private static final String TAG_PAGE_CITY = "同城";
private static final String TAG_PAGE_PUBLISH = "发布";
private static final String TAG_PAGE_MESSAGE = "消息";
private static final String TAG_PAGE_PERSON = "我的";
private MainNavigateTabBar mNavigateTabBar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mNavigateTabBar = (MainNavigateTabBar) findViewById(R.id.mainTabBar);
mNavigateTabBar.onRestoreInstanceState(savedInstanceState);
mNavigateTabBar.addTab(HomeFragment.class, new MainNavigateTabBar.TabParam(R.mipmap.comui_tab_home, R.mipmap.comui_tab_home_selected, TAG_PAGE_HOME));
mNavigateTabBar.addTab(CityFragment.class, new MainNavigateTabBar.TabParam(R.mipmap.comui_tab_city, R.mipmap.comui_tab_city_selected, TAG_PAGE_CITY));
mNavigateTabBar.addTab(null, new MainNavigateTabBar.TabParam(0, 0, TAG_PAGE_PUBLISH));
mNavigateTabBar.addTab(MessageFragment.class, new MainNavigateTabBar.TabParam(R.mipmap.comui_tab_message, R.mipmap.comui_tab_message_selected, TAG_PAGE_MESSAGE));
mNavigateTabBar.addTab(PersonFragment.class, new MainNavigateTabBar.TabParam(R.mipmap.comui_tab_person, R.mipmap.comui_tab_person_selected, TAG_PAGE_PERSON));
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
mNavigateTabBar.onSaveInstanceState(outState);
}
public void onClickPublish(View v) {
Toast.makeText(this, "发布", Toast.LENGTH_LONG).show();
}
}

@ -0,0 +1,24 @@
package com.startsmake.llrisetabbardemo.fragment;
import android.app.Fragment;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.startsmake.llrisetabbardemo.R;
/**
* User:Shine
* Date:2015-10-20
* Description:
*/
public class CityFragment extends Fragment {
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_city, container, false);
}
}

@ -0,0 +1,25 @@
package com.startsmake.llrisetabbardemo.fragment;
import android.app.Fragment;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.startsmake.llrisetabbardemo.R;
/**
* User:Shine
* Date:2015-10-20
* Description:
*/
public class HomeFragment extends Fragment {
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_home, container, false);
}
}

@ -0,0 +1,24 @@
package com.startsmake.llrisetabbardemo.fragment;
import android.app.Fragment;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.startsmake.llrisetabbardemo.R;
/**
* User:Shine
* Date:2015-10-20
* Description:
*/
public class MessageFragment extends Fragment {
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_message, container, false);
}
}

@ -0,0 +1,24 @@
package com.startsmake.llrisetabbardemo.fragment;
import android.app.Fragment;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.startsmake.llrisetabbardemo.R;
/**
* User:Shine
* Date:2015-10-20
* Description:
*/
public class PersonFragment extends Fragment {
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_person, container, false);
}
}

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="@+id/main_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/mainTabBar"/>
<com.startsmake.mainnavigatetabbar.widget.MainNavigateTabBar
android:id="@+id/mainTabBar"
android:layout_width="match_parent"
android:layout_height="50.0dip"
android:layout_alignParentBottom="true"
android:background="@android:color/white"
app:containerId="@+id/main_container"
app:navigateTabSelectedTextColor="@color/comui_tab_text_color"
app:navigateTabTextColor="@color/comui_tab_text_color"/>
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/mainTabBar"
android:background="@mipmap/comui_bar_top_shadow"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="76.0dip"
android:layout_alignParentBottom="true"
android:background="@android:color/transparent"
android:gravity="center|top"
android:orientation="vertical">
<ImageView
android:id="@+id/tab_post_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="onClickPublish"
android:src="@mipmap/comui_tab_post"/>
</LinearLayout>
</RelativeLayout>

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0.0dip"
android:layout_weight="1.0"
android:gravity="center">
<ImageView
android:id="@+id/tab_icon"
android:layout_width="24.0dip"
android:layout_height="24.0dip"/>
</LinearLayout>
<TextView
android:id="@+id/tab_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/comui_tab_text_marginBottom"
android:textColor="@color/comui_tab_text_color"
android:textSize="9.0sp"/>
</LinearLayout>

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="同城"/>
</FrameLayout>

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="首页"/>
</FrameLayout>

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="消息"/>
</FrameLayout>

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="我的"/>
</FrameLayout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 165 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 793 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 983 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

@ -0,0 +1,6 @@
<resources>
<!-- Example customization of dimensions originally defined in res/values/dimens.xml
(such as screen margins) for screens with more than 820dp of available width. This
would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). -->
<dimen name="activity_horizontal_margin">64dp</dimen>
</resources>

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>
<color name="comui_tab_text_color">#ff333333</color>
</resources>

@ -0,0 +1,7 @@
<resources>
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
<dimen name="comui_tab_text_marginBottom">4.0dip</dimen>
</resources>

@ -0,0 +1,3 @@
<resources>
<string name="app_name">LLRiseTabBarDemo</string>
</resources>

@ -0,0 +1,11 @@
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<!--<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>-->
</style>
</resources>

@ -0,0 +1,15 @@
package com.startsmake.llrisetabbardemo;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* To work on unit tests, switch the Test Artifact in the Build Variants view.
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
}

@ -0,0 +1,25 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.4.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

@ -0,0 +1,18 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

@ -0,0 +1,6 @@
#Sat Oct 11 19:07:18 CST 2025
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.0-milestone-1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

@ -0,0 +1,164 @@
#!/usr/bin/env bash
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
echo "$*"
}
die ( ) {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
esac
# For Cygwin, ensure paths are in UNIX format before anything is touched.
if $cygwin ; then
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
fi
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >&-
APP_HOME="`pwd -P`"
cd "$SAVED" >&-
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"

@ -0,0 +1,90 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windowz variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

@ -0,0 +1,23 @@
apply plugin: 'com.android.library'
android {
namespace "com.startsmake.mainnavigatetabbar"
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:23.1.1'
}

@ -0,0 +1,17 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /Users/shine/Library/Android/sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

@ -0,0 +1,13 @@
package com.startsmake.mainnavigatetabbar;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
}

@ -0,0 +1,11 @@
<manifest package="com.startsmake.mainnavigatetabbar"
xmlns:android="http://schemas.android.com/apk/res/android">
<application android:allowBackup="true"
android:label="@string/app_name"
android:supportsRtl="true"
>
</application>
</manifest>

@ -0,0 +1,26 @@
package com.startsmake.mainnavigatetabbar;
import android.content.Context;
import android.content.res.TypedArray;
/**
* User:Shine
* Date:2015-11-20
* Description:
*/
public class ThemeUtils {
private static final int[] APPCOMPAT_CHECK_ATTRS = {android.R.attr.colorForeground};
public static void checkAppCompatTheme(Context context) {
TypedArray a = context.obtainStyledAttributes(APPCOMPAT_CHECK_ATTRS);
final boolean failed = !a.hasValue(0);
if (a != null) {
a.recycle();
}
if (failed) {
throw new IllegalArgumentException("You need to use a Theme.AppCompat theme "
+ "(or descendant) with the design library.");
}
}
}

@ -0,0 +1,383 @@
package com.startsmake.mainnavigatetabbar.widget;
import android.app.Fragment;
import android.app.FragmentTransaction;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.startsmake.mainnavigatetabbar.R;
import com.startsmake.mainnavigatetabbar.ThemeUtils;
import java.util.ArrayList;
import java.util.List;
/**
* User:Shine
* Date:2015-10-29
* Description:
*/
public class MainNavigateTabBar extends LinearLayout implements View.OnClickListener {
private static final String KEY_CURRENT_TAG = "com.startsmake.template。currentTag";
private List<ViewHolder> mViewHolderList;
private OnTabSelectedListener mTabSelectListener;
private FragmentActivity mFragmentActivity;
private String mCurrentTag;
private String mRestoreTag;
/*主内容显示区域View的id*/
private int mMainContentLayoutId;
/*选中的Tab文字颜色*/
private ColorStateList mSelectedTextColor;
/*正常的Tab文字颜色*/
private ColorStateList mNormalTextColor;
/*Tab文字的颜色*/
private float mTabTextSize;
/*默认选中的tab index*/
private int mDefaultSelectedTab = 0;
private int mCurrentSelectedTab;
public MainNavigateTabBar(Context context) {
this(context, null);
}
public MainNavigateTabBar(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public MainNavigateTabBar(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
TypedArray typedArray = context.getTheme().obtainStyledAttributes(attrs, R.styleable.MainNavigateTabBar, 0, 0);
ColorStateList tabTextColor = typedArray.getColorStateList(R.styleable.MainNavigateTabBar_navigateTabTextColor);
ColorStateList selectedTabTextColor = typedArray.getColorStateList(R.styleable.MainNavigateTabBar_navigateTabSelectedTextColor);
mTabTextSize = typedArray.getDimensionPixelSize(R.styleable.MainNavigateTabBar_navigateTabTextSize, 0);
mMainContentLayoutId = typedArray.getResourceId(R.styleable.MainNavigateTabBar_containerId, 0);
mNormalTextColor = (tabTextColor != null ? tabTextColor : context.getResources().getColorStateList(R.color.tab_text_normal));
if (selectedTabTextColor != null) {
mSelectedTextColor = selectedTabTextColor;
} else {
ThemeUtils.checkAppCompatTheme(context);
TypedValue typedValue = new TypedValue();
context.getTheme().resolveAttribute(android.R.attr.colorForeground, typedValue, true);
mSelectedTextColor = context.getResources().getColorStateList(typedValue.resourceId);
}
mViewHolderList = new ArrayList<>();
}
public void addTab(Class frameLayoutClass, TabParam tabParam) {
int defaultLayout = R.layout.comui_tab_view;
// if (tabParam.tabViewResId > 0) {
// defaultLayout = tabParam.tabViewResId;
// }
if (TextUtils.isEmpty(tabParam.title)) {
tabParam.title = getContext().getString(tabParam.titleStringRes);
}
View view = LayoutInflater.from(getContext()).inflate(defaultLayout, null);
view.setFocusable(true);
ViewHolder holder = new ViewHolder();
holder.tabIndex = mViewHolderList.size();
holder.fragmentClass = frameLayoutClass;
holder.tag = tabParam.title;
holder.pageParam = tabParam;
holder.tabIcon = (ImageView) view.findViewById(R.id.tab_icon);
holder.tabTitle = ((TextView) view.findViewById(R.id.tab_title));
if (TextUtils.isEmpty(tabParam.title)) {
holder.tabTitle.setVisibility(View.INVISIBLE);
} else {
holder.tabTitle.setText(tabParam.title);
}
if (mTabTextSize != 0) {
holder.tabTitle.setTextSize(TypedValue.COMPLEX_UNIT_PX, mTabTextSize);
}
if (mNormalTextColor != null) {
holder.tabTitle.setTextColor(mNormalTextColor);
}
if (tabParam.backgroundColor > 0) {
view.setBackgroundResource(tabParam.backgroundColor);
}
if (tabParam.iconResId > 0) {
holder.tabIcon.setImageResource(tabParam.iconResId);
} else {
holder.tabIcon.setVisibility(View.INVISIBLE);
}
if (tabParam.iconResId > 0 && tabParam.iconSelectedResId > 0) {
view.setTag(holder);
view.setOnClickListener(this);
mViewHolderList.add(holder);
}
addView(view, new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, 1.0F));
}
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
if (mMainContentLayoutId == 0) {
throw new RuntimeException("mFrameLayoutId Cannot be 0");
}
if (mViewHolderList.size() == 0) {
throw new RuntimeException("mViewHolderList.size Cannot be 0, Please call addTab()");
}
if (!(getContext() instanceof FragmentActivity)) {
throw new RuntimeException("parent activity must is extends FragmentActivity");
}
mFragmentActivity = (FragmentActivity) getContext();
ViewHolder defaultHolder = null;
hideAllFragment();
if (!TextUtils.isEmpty(mRestoreTag)) {
for (ViewHolder holder : mViewHolderList) {
if (TextUtils.equals(mRestoreTag, holder.tag)) {
defaultHolder = holder;
mRestoreTag = null;
break;
}
}
} else {
defaultHolder = mViewHolderList.get(mDefaultSelectedTab);
}
showFragment(defaultHolder);
}
@Override
public void onClick(View v) {
Object object = v.getTag();
if (object != null && object instanceof ViewHolder) {
ViewHolder holder = (ViewHolder) v.getTag();
showFragment(holder);
if (mTabSelectListener != null) {
mTabSelectListener.onTabSelected(holder);
}
}
}
/**
* holder fragment
*
* @param holder
*/
private void showFragment(ViewHolder holder) {
FragmentTransaction transaction = mFragmentActivity.getFragmentManager().beginTransaction();
if (isFragmentShown(transaction, holder.tag)) {
return;
}
setCurrSelectedTabByTag(holder.tag);
Fragment fragment = mFragmentActivity.getFragmentManager().findFragmentByTag(holder.tag);
if (fragment == null) {
fragment = getFragmentInstance(holder.tag);
transaction.add(mMainContentLayoutId, fragment, holder.tag);
} else {
transaction.show(fragment);
}
transaction.commit();
mCurrentSelectedTab = holder.tabIndex;
}
private boolean isFragmentShown(FragmentTransaction transaction, String newTag) {
if (TextUtils.equals(newTag, mCurrentTag)) {
return true;
}
if (TextUtils.isEmpty(mCurrentTag)) {
return false;
}
Fragment fragment = mFragmentActivity.getFragmentManager().findFragmentByTag(mCurrentTag);
if (fragment != null && !fragment.isHidden()) {
transaction.hide(fragment);
}
return false;
}
/*设置当前选中tab的图片和文字颜色*/
private void setCurrSelectedTabByTag(String tag) {
if (TextUtils.equals(mCurrentTag, tag)) {
return;
}
for (ViewHolder holder : mViewHolderList) {
if (TextUtils.equals(mCurrentTag, holder.tag)) {
holder.tabIcon.setImageResource(holder.pageParam.iconResId);
holder.tabTitle.setTextColor(mNormalTextColor);
} else if (TextUtils.equals(tag, holder.tag)) {
holder.tabIcon.setImageResource(holder.pageParam.iconSelectedResId);
holder.tabTitle.setTextColor(mSelectedTextColor);
}
}
mCurrentTag = tag;
}
private Fragment getFragmentInstance(String tag) {
Fragment fragment = null;
for (ViewHolder holder : mViewHolderList) {
if (TextUtils.equals(tag, holder.tag)) {
try {
fragment = (Fragment) Class.forName(holder.fragmentClass.getName()).newInstance();
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
break;
}
}
return fragment;
}
private void hideAllFragment() {
if (mViewHolderList == null || mViewHolderList.size() == 0) {
return;
}
FragmentTransaction transaction = mFragmentActivity.getFragmentManager().beginTransaction();
for (ViewHolder holder : mViewHolderList) {
Fragment fragment = mFragmentActivity.getFragmentManager().findFragmentByTag(holder.tag);
if (fragment != null && !fragment.isHidden()) {
transaction.hide(fragment);
}
}
transaction.commit();
}
public void setSelectedTabTextColor(ColorStateList selectedTextColor) {
mSelectedTextColor = selectedTextColor;
}
public void setSelectedTabTextColor(int color) {
mSelectedTextColor = ColorStateList.valueOf(color);
}
public void setTabTextColor(ColorStateList color) {
mNormalTextColor = color;
}
public void setTabTextColor(int color) {
mNormalTextColor = ColorStateList.valueOf(color);
}
public void setFrameLayoutId(int frameLayoutId) {
mMainContentLayoutId = frameLayoutId;
}
public void onRestoreInstanceState(Bundle savedInstanceState) {
if (savedInstanceState != null) {
mRestoreTag = savedInstanceState.getString(KEY_CURRENT_TAG);
}
}
public void onSaveInstanceState(Bundle outState) {
outState.putString(KEY_CURRENT_TAG, mCurrentTag);
}
private static class ViewHolder {
public String tag;
public TabParam pageParam;
public ImageView tabIcon;
public TextView tabTitle;
public Class fragmentClass;
public int tabIndex;
}
public static class TabParam {
public int backgroundColor = android.R.color.white;
public int iconResId;
public int iconSelectedResId;
public int titleStringRes;
// public int tabViewResId;
public String title;
public TabParam(int iconResId, int iconSelectedResId, String title) {
this.iconResId = iconResId;
this.iconSelectedResId = iconSelectedResId;
this.title = title;
}
public TabParam(int iconResId, int iconSelectedResId, int titleStringRes) {
this.iconResId = iconResId;
this.iconSelectedResId = iconSelectedResId;
this.titleStringRes = titleStringRes;
}
public TabParam(int backgroundColor, int iconResId, int iconSelectedResId, int titleStringRes) {
this.backgroundColor = backgroundColor;
this.iconResId = iconResId;
this.iconSelectedResId = iconSelectedResId;
this.titleStringRes = titleStringRes;
}
public TabParam(int backgroundColor, int iconResId, int iconSelectedResId, String title) {
this.backgroundColor = backgroundColor;
this.iconResId = iconResId;
this.iconSelectedResId = iconSelectedResId;
this.title = title;
}
}
public interface OnTabSelectedListener {
void onTabSelected(ViewHolder holder);
}
public void setTabSelectListener(OnTabSelectedListener tabSelectListener) {
mTabSelectListener = tabSelectListener;
}
public void setDefaultSelectedTab(int index) {
if (index >= 0 && index < mViewHolderList.size()) {
mDefaultSelectedTab = index;
}
}
public void setCurrentSelectedTab(int index) {
if (index >= 0 && index < mViewHolderList.size()) {
ViewHolder holder = mViewHolderList.get(index);
showFragment(holder);
}
}
public int getCurrentSelectedTab(){
return mCurrentSelectedTab;
}
}

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:id="@+id/tab_icon"
android:layout_width="24.0dip"
android:layout_height="0dp"
android:layout_weight="1"
android:scaleType="centerInside"/>
<TextView
android:id="@+id/tab_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="4dip"
android:textColor="@color/tab_text_normal"
android:textSize="9.0sp"/>
</LinearLayout>

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="MainNavigateTabBar">
<attr name="navigateTabTextColor" format="color|reference"/>
<attr name="navigateTabSelectedTextColor" format="color|reference"/>
<attr name="containerId" format="integer|reference"/>
<attr name="navigateTabTextSize" format="dimension|reference"/>
</declare-styleable>
</resources>

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="tab_text_normal">#212121</color>
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>
</resources>

@ -0,0 +1,3 @@
<resources>
<string name="app_name">Library</string>
</resources>

@ -0,0 +1,7 @@
<resources>
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
</resources>

@ -0,0 +1 @@
include ':app', ':mainnavigatetabbar'
Loading…
Cancel
Save