summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2019-12-12 00:08:38 +0100
committerArne Schwabe <arne@rfc2549.org>2019-12-12 00:08:38 +0100
commitd1de65101a3b19db7badc313e575e38c1ce1b468 (patch)
treeb58b4f1ebb084fb8d7c80cd13d831a9a7eceb2d7
parent89fd370033222c470a8689649baa259f5e308bf4 (diff)
Make tab bar better on small devices, worse on large ... :/
-rw-r--r--main/src/main/res/color/tab_text.xml5
-rw-r--r--main/src/ui/res/layout/main_activity.xml28
-rw-r--r--main/src/ui/res/values/styles.xml17
3 files changed, 33 insertions, 17 deletions
diff --git a/main/src/main/res/color/tab_text.xml b/main/src/main/res/color/tab_text.xml
new file mode 100644
index 00000000..0bfb7dce
--- /dev/null
+++ b/main/src/main/res/color/tab_text.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:color="?attr/android:textColorPrimary" android:state_selected="true" />
+ <item android:color="?attr/android:textColorSecondaryInverseNoDisable" />
+</selector> \ No newline at end of file
diff --git a/main/src/ui/res/layout/main_activity.xml b/main/src/ui/res/layout/main_activity.xml
index d47bacc5..b2fe2251 100644
--- a/main/src/ui/res/layout/main_activity.xml
+++ b/main/src/ui/res/layout/main_activity.xml
@@ -4,25 +4,27 @@
-->
<LinearLayout 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"
- android:orientation="vertical">
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
<androidx.viewpager.widget.ViewPager
- android:id="@+id/pager"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
+ android:id="@+id/pager"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
<com.google.android.material.tabs.TabLayout
- style="@style/AppTabLayout"
- android:id="@+id/tab_layout"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_gravity="top"
+ android:id="@+id/tab_layout"
+ style="@style/blinkt.tabLayout"
+ app:tabMaxWidth="0dp"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_gravity="top"
+ app:tabMode="scrollable"
- />
+ />
</androidx.viewpager.widget.ViewPager>
diff --git a/main/src/ui/res/values/styles.xml b/main/src/ui/res/values/styles.xml
index f90da367..e422124d 100644
--- a/main/src/ui/res/values/styles.xml
+++ b/main/src/ui/res/values/styles.xml
@@ -79,20 +79,29 @@
<item name="android:windowContentOverlay">@null</item>
</style>
- <style name="AppTabLayout" parent="Widget.Design.TabLayout">
+ <style name="blinkt.tabLayout" parent="Widget.Design.TabLayout">
<item name="tabIndicatorColor">?attr/colorAccent</item>
<item name="tabIndicatorHeight">4dp</item>
- <item name="tabPaddingStart">2dp</item>
- <item name="tabPaddingEnd">2dp</item>
+
<item name="tabBackground">@color/primary</item>
<item name="tabTextAppearance">@style/AppTabTextAppearance</item>
<item name="tabSelectedTextColor">@android:color/white</item>
+
+ <!-- <item name="tabPaddingStart">10dp</item>-->
+ <!-- <item name="tabPaddingEnd">10dp</item>-->
+
+
+ <item name="tabGravity">fill</item>
+ <item name="tabMaxWidth">0dp</item>
+
</style>
- <!-- for text -->
<style name="AppTabTextAppearance" parent="TextAppearance.Design.Tab">
<item name="textAllCaps">true</item>
+ <item name="android:textStyle">bold</item>
+ <item name="android:textColor">@color/tab_text</item>
</style>
+
</resources> \ No newline at end of file