android-tabs

Tab+ViewPager not updating instead shows weird warning expected state 3 found 2

左心房为你撑大大i 提交于 2019-11-27 13:17:37
问题 I have a mainactivity which includes a TabLayout with ViewPager I have added 3 tabs and each tab has separate fragments which contains a recyclerview, and these recyclerviews has a checkbox that should be simultaneously updated/refreshed whenever i swipe the viewpager(i save checked positions in shared preference and updates via shared preference). My problem here is whenever i check a checkbox in tab1, tab2 is not updating/refreshing until i scroll down the Recyclerview. and tab3 is working

Add Icons to SlidingTabLayout instead of Text

☆樱花仙子☆ 提交于 2019-11-27 12:26:29
I'm implementing a SlidingTabLayout in my android application. What my query is that I'd like to implement icons in my Sliding Tabs instead of texts for navigation. I searched heavily on the internet for any such tutorial or sample but found none. I also searched a previous question on stackoverflow: Over Here - SlidingTabLayout with Icons . It was slightly informative but didn't really help me out. To be clear. I require my tabs to consist of icons only . No text. As I am new to this whole setup, I'd appreciate if you'd post proper code with an explanation. Thank you for your time and effort!

Add Icons+Text to TabLayout

社会主义新天地 提交于 2019-11-27 11:30:35
I am working on a screen which contains Three tabs I am trying to add an icon with My text in tabs and i want the image to be upper the text and there should be some space between them it is my code. public class HomeScreen extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener { private Toolbar toolbar; private ViewPager pager; private ViewPagerAdapter adapter; private SlidingTabLayout tabs; private CharSequence Titles[] = {"News", "Most Views", "Chart"}; int Numboftabs = 3; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate

Getting DrawerLayout to Slide over the ActionBar

浪尽此生 提交于 2019-11-27 10:57:43
I have a sliding drawer menu in an activity, which has an actionbar with some tabs on it. I'd like to get the sliding drawer to slide over the tabs , not below them. This is what it looks like right now... Any ideas on how this could be done? Note: I understand that I might be breaking some conventions and UI patterns here, and if it does not work at all, I'll look at alternatives. But I'd like to get this working first. EDIT: See the below screen shot of the Google Play Music app that does exactly what I need. See @CommonsWare's answer below where he does agree that I might be breaking

How to style the divider between Ice Cream Sandwich tabs?

回眸只為那壹抹淺笑 提交于 2019-11-27 10:02:51
I'm using the following style together with a set of nine patch images to create a red line at the bottom of some Ice Cream Sandwich tabs instead of the standard blue line: <style name="customTabStyle" parent="@android:style/Widget.Holo.ActionBar.TabBar"> <item name="android:tabStripLeft">@null</item> <item name="android:tabStripRight">@null</item> <item name="android:tabStripEnabled">false</item> <item name="android:showDividers">none</item> <item name="android:measureWithLargestChild">true</item> <item name="android:background">@drawable/tab_line</item> <item name="android:gravity">center<

Tablayout with icons only

感情迁移 提交于 2019-11-27 09:31:19
问题 I am using design support to create tabs. I am also using ViewPager for swipable tabs. Now, I don't know how to use only icons instead of texts in tabs. I tried finding out but didn't get any success. My code: Toolbar toolbar; private TabLayout tabLayout; private ViewPager viewPager; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); viewPager = (ViewPager) findViewById(R.id.pager); setupViewPager

Fragment view in ViewPager is not restored when resuming

醉酒当歌 提交于 2019-11-27 09:11:37
I have ActionBar Tabs setup. It consists of 4 tabs. Everything is fine until I navigate away from TabbedFragment and returning back. I create tabs like this: @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); final ActionBar actionBar = getActionBar(); tabs = Lists.newArrayList(); tabs.add(new TabDefinition<>("Tab 1")); tabs.add(new TabDefinition<>("Tab 2")); tabs.add(new TabDefinition<>("Tab 3")); tabs.add(new TabDefinition<>("Tab 4")); for (TabDefinition tab : tabs) { actionBar.addTab(actionBar.newTab() .setText(tab.text) .setTag(tab.tag)

android center align the selected tab in tablayout

♀尐吖头ヾ 提交于 2019-11-27 09:06:47
I am using android support design tablayout. Here's my code: <android.support.design.widget.TabLayout android:id="@+id/tabs" android:layout_width="match_parent" android:layout_height="wrap_content"" app:tabGravity="center" app:tabMode="scrollable" /> <android.support.v4.view.ViewPager android:id="@+id/view_pager" android:layout_width="match_parent" android:layout_height="match_parent" /> My issue is the tabs always align left. However, I would like to center the selected tab (even at the beginning, the first(selected) tab should be centered). Is there a way to do this? Thanks. I took a look

Changing ActionBar tabs underline color programmatically

ぃ、小莉子 提交于 2019-11-27 08:51:18
I have created the action bar by ActionBar actionbar = getActionBar() The background of the action bar is changed by actionbar.setBackgroundDrawable(actionBarBackgroundImage); Now I need to change the action bar tabs underline color programmatically. Is there any method to change the action bar tabs underline color? Alternatively you could use Android Action Bar Style Generator to easily theme your action bar and tabs. Kenny Wyland Here is a much easier way. I know you were looking for a programmatic change, but this one is REALLY easy. I've been struggling with this for days, but finally

How to customize android tabs or background change?

对着背影说爱祢 提交于 2019-11-27 08:23:33
I am very new to android. Now I build a small application. I need to change the look and feel of android default look up in 2.2. So, here I try to change the background of the tabs. Can you help me to do that. I love the way using the xml/style. This is what I need that actual output. Your Tab Host XML file TabHost <?xml version="1.0" encoding="utf-8"?> <TabHost xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/tabhost" android:layout_width="fill_parent" android:layout_height="fill_parent"> <LinearLayout android:orientation="vertical" android:layout_width="fill