android-tabs

Android 5.0 Material-styled tabs

旧时模样 提交于 2019-11-26 19:24:33
问题 Does the Android 5.0 framework have Material-styled tabs? I know in the dev preview, they were still Holo-styled. I was wondering if 5.0 has been updated with material-style tabs; I currently use PagerSlidingTabStrip for my tabs, but that has not been updated with Material design yet. More specifically, does the support library include an implementation of material tabs? The Play Store running on 4.x has those tabs, but I'm not sure if that's a custom implementation by Google or not. 回答1:

How do I change a tab background color when using TabLayout?

只谈情不闲聊 提交于 2019-11-26 18:30:50
This is my code in the main activity public class FilterActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_filter); // Get the ViewPager and set it's PagerAdapter so that it can display items ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager); PageAdapter pageAdapter = new PageAdapter(getSupportFragmentManager(), FilterActivity.this); viewPager.setAdapter(pageAdapter); // Give the TabLayout the ViewPager final TabLayout tabLayout = (TabLayout) findViewById(R.id

Creating tabs using Fragments now that TabActivity is deprecated

喜欢而已 提交于 2019-11-26 17:48:18
I am creating an application which has five tabs at the bottom of the screen, each of which opens a different Activity. My Tab Activity extends TabActivity which I have just read is deprecated and I should use Fragments instead. How do I change my app to use Fragments instead? I have read the information on android.developer.com but I still have no idea how to do this. You will need to use the android compatibility library to use fragments. It can be found as a jar file in your android sdk folder. There are many tutorials out there for fragments. There is a project named ActionBarSherlock

Change the text size in tab in android

落花浮王杯 提交于 2019-11-26 17:16:33
问题 I've been facing the issue of text size in tab bar. Below is the image, And here is my code, MainActivity.java public class MainActivity extends Activity implements OnTabChangeListener, OnPageChangeListener{ private TabHost tabHost; private ViewPager pager; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); tabHost = (TabHost)findViewById(android.R.id.tabhost); pager = (ViewPager) findViewById(R.id.pager);

Add Icons to SlidingTabLayout instead of Text

我与影子孤独终老i 提交于 2019-11-26 16:04:18
问题 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

Add Icons+Text to TabLayout

大城市里の小女人 提交于 2019-11-26 15:26:46
问题 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

How to style the divider between Ice Cream Sandwich tabs?

妖精的绣舞 提交于 2019-11-26 15:00:26
问题 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<

Changing ActionBar tabs underline color programmatically

随声附和 提交于 2019-11-26 14:20:07
问题 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? 回答1: Alternatively you could use Android Action Bar Style Generator to easily theme your action bar and tabs. 回答2: Here is a much easier way. I know you were looking for a

how to add the icon for swipeable tabs

人走茶凉 提交于 2019-11-26 12:13:55
问题 I am downloading the code from here i want to dispaly tabs with icon how can posssible please help me. public class MainActivity extends FragmentActivity implements ActionBar.TabListener { private ViewPager viewPager; private TabsPagerAdapter mAdapter; private ActionBar actionBar; // Tab titles private String[] tabs = { \"Text\", \"Photo\", \"Record\" ,\"Tag\"}; @TargetApi(Build.VERSION_CODES.HONEYCOMB) @SuppressLint(\"NewApi\") @Override protected void onCreate(Bundle savedInstanceState) {

Fragment view in ViewPager is not restored when resuming

一个人想着一个人 提交于 2019-11-26 11:28: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\"));