android-tablayout

Disable click on tablayout, when setup with viewpager

╄→гoц情女王★ 提交于 2021-01-28 06:16:30
问题 I have a ViewPager (3 items) with some icons. When on first item, the icon is selected, there is possible to swipe to the next item. Etc. After selected second icon, there is possibility to go to the third item of viewpager. I have a page indicator (dots), which is connected with ViewPager by setupWithViewPager. The problem is that I want to set clickable on tablayout to false, and unlock steps if the icon on viewPager is selected. Now all "dots" are clickable and I can go to the all items of

Selected custom tab text color in TabLayout

落花浮王杯 提交于 2021-01-27 14:00:54
问题 I'm trying to create custom tab layout because I need to set badge counter next to TextView . I've set id to @android:id/text1 as it's mentioned in doc. When my custom tab is selected, TextView color isn't changed automatically. How to achieve it in correct and clean way? Properly selected default tab: Wrong selected custom tab (text is grey but should be white): Code PagerAdapter adapter = new MyAdapter(getSupportFragmentManager()); viewPager.setAdapter(adapter); tabLayout.setupWithViewPager

Smooth animation between tabs when using selector - Android

荒凉一梦 提交于 2021-01-20 19:45:25
问题 I would like to get the background of the tab animated smoothly to the selected position (just like the default tabIndicator animates between tabs). Here is how my TabLayout looks like <android.support.design.widget.TabLayout android:layout_marginTop="10dp" android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/tabLayout" app:tabBackground="@drawable/tab_selector" app:tabTextColor="@color/white" android:background="@drawable/tab_layout_bg" app

Smooth animation between tabs when using selector - Android

半腔热情 提交于 2021-01-20 19:44:58
问题 I would like to get the background of the tab animated smoothly to the selected position (just like the default tabIndicator animates between tabs). Here is how my TabLayout looks like <android.support.design.widget.TabLayout android:layout_marginTop="10dp" android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/tabLayout" app:tabBackground="@drawable/tab_selector" app:tabTextColor="@color/white" android:background="@drawable/tab_layout_bg" app

Adjust height between Tablayout title text and icon

我只是一个虾纸丫 提交于 2021-01-02 05:39:12
问题 I there any way to reduce the distance between the title text and the icon of TabLayout like in Google plus where the icons and text title have at least no distance. I have searched , but couldn't find anyway till now. EDITED This is how I am setting icon and title: tabLayout.getTabAt(3).setIcon(R.drawable.ic_more_horiz_white_24dp); tabLayout.getTabAt(3).setText("More"); And this is my TabLayout : <android.support.design.widget.TabLayout android:id="@+id/tabs" android:layout_width="match

E/iardini.error0: Invalid ID 0x00000001 - Error resource ID

随声附和 提交于 2021-01-01 09:37:05
问题 I am currently stuck on an error that continues to slow down the performance of my application. The error does not cause the application to close or crash, or to write an exception to the console. The console simply reports this message: E/iardini.error0: Invalid ID 0x00000001. The only things that emerge from the message are: It's an error, you understand from the prefix "E/" The error is within my app, "iardini.error0" Didn't recognize some kind of id How replicate the error: I've made a

TabLayout set text size of TabLayout.Tab from code (programmatically)

蹲街弑〆低调 提交于 2020-12-13 04:17:54
问题 I'm trying to set up a text size from code, since this option does not exist does anyone have an idea how to achieve this? I know it's possible through style, but I can't use style. Also I tried this example, but it doesn't work. I have partially (some Tabs get new text size) succes with this: try { Field tabTextSize = TabLayout.class.getDeclaredField("mTabTextSize"); tabTextSize.setAccessible(true); tabTextSize.setFloat(mTabLayout, 64f); } catch (Exception e) { e.printStackTrace(); } 回答1:

TabLayout set text size of TabLayout.Tab from code (programmatically)

╄→гoц情女王★ 提交于 2020-12-13 04:17:49
问题 I'm trying to set up a text size from code, since this option does not exist does anyone have an idea how to achieve this? I know it's possible through style, but I can't use style. Also I tried this example, but it doesn't work. I have partially (some Tabs get new text size) succes with this: try { Field tabTextSize = TabLayout.class.getDeclaredField("mTabTextSize"); tabTextSize.setAccessible(true); tabTextSize.setFloat(mTabLayout, 64f); } catch (Exception e) { e.printStackTrace(); } 回答1:

Android TabLayout prevent activation of tabs adjacent to selected

試著忘記壹切 提交于 2020-08-10 19:35:34
问题 I have a tab-based app. I am using A TabLayout for my tabs and a subclass of FragmentStatePagerAdapter to instantiate the fragment for the selected tab. I have disabled swiping between tabs. I am still seeing a callback to create a fragment for tabs adjacent to the selected tab. In other words, if the tab at index 0 is activated, I also see a callback to GetItem for the tab at index 1. I want to disable that behaviour. In other words, it should only request a fragment for the active tab. Is