سؤال

How to change the background color of sliding tabs?

android:backgroundStacked property is not working for this one. It is working for fixed tabs.

هل كانت مفيدة؟

المحلول 2

I finally figured out the method. First I need to mention that scrollable tabs are created using ViewPager.

(But in Fixed tabs we normally get a reference to the actionbar and then create tabs and add to actionbar)

Then we create the adapter and fragments to create the scrollable tabs. For more details about how to create scrollable tabs watch this video.

How to create scrollable tabs in android

What we see as a tab actually is the ViewPager. So simple thing is to change the background color of the ViewPager.So the entire page will get affected by the background color.

But in my case I have put a listview on top of the ViewPager using fragments. So it displays only the top part of the ViewPager which feels like colored scrollable tabs. I have put a screenshot as well for clarification.

enter image description here

نصائح أخرى

Use this

http://jgilfelt.github.io/android-actionbarstylegenerator/

simply design whatever colors you want and copy those styles to your project .

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top