android-tabs

How to change selected Tab Text color using TabLayout from code in Android?

半城伤御伤魂 提交于 2020-06-09 07:56:08
问题 I'm using android.support.widget.TabLayout to make a Tab view, and I want to change the selected tabs text color from code (not from xml or by styling). How can I do this ? 回答1: If you are using the design support library add this code to your tab activity . tabLayout.setSelectedTabIndicatorColor(Color.parseColor("#FF0000")); tabLayout.setSelectedTabIndicatorHeight((int) (5 * getResources().getDisplayMetrics().density)); tabLayout.setTabTextColors(Color.parseColor("#727272"), Color.parseColor

Viewpager tabs recreated?

与世无争的帅哥 提交于 2020-02-23 03:54:17
问题 I have implemented a NavigationDrawer with a few items in it. Every item represents a different Fragment and one of them has tabs. My problem is that every time I open this Fragment the tabs reloaded! and added to the previous tabs. Why is this happening and how can I solve it? This is the Fragment with the tabs: public class fragment_profilo_tabs extends Fragment implements ActionBar.TabListener { private ViewPager viewPager; private TabsPagerAdapter mAdapter; private ActionBar actionBar; //

Viewpager tabs recreated?

会有一股神秘感。 提交于 2020-02-23 03:53:10
问题 I have implemented a NavigationDrawer with a few items in it. Every item represents a different Fragment and one of them has tabs. My problem is that every time I open this Fragment the tabs reloaded! and added to the previous tabs. Why is this happening and how can I solve it? This is the Fragment with the tabs: public class fragment_profilo_tabs extends Fragment implements ActionBar.TabListener { private ViewPager viewPager; private TabsPagerAdapter mAdapter; private ActionBar actionBar; //

How to make tabs with webview to load from a web address?

懵懂的女人 提交于 2020-02-02 06:05:12
问题 I want to build an application in Android Studio. I have inside tabs: | tab one | tab two | tab three | ...and each tab should load a webview page. For example: tab one should load www.google.com, and tab two should load www.youtube.com, ... How can I build this? 回答1: Here It Is activity_main.xml <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/activity_main" android:layout_width="match_parent" android:layout_height="match_parent" /> MainActivity.java

How to make tabs with webview to load from a web address?

随声附和 提交于 2020-02-02 06:00:19
问题 I want to build an application in Android Studio. I have inside tabs: | tab one | tab two | tab three | ...and each tab should load a webview page. For example: tab one should load www.google.com, and tab two should load www.youtube.com, ... How can I build this? 回答1: Here It Is activity_main.xml <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/activity_main" android:layout_width="match_parent" android:layout_height="match_parent" /> MainActivity.java

NullPointerException ViewPager SetAdapter

落爺英雄遲暮 提交于 2020-01-22 02:35:09
问题 I am adding a tab view or (ViewPager) to my Fragment in an App I am working on. I want to put the tab view inside the Contact Fragment I have a Navigation Drawer that opens, and you see list of options... Home Services Contact Everything you click goes to a fragment Then in that fragment loads the .XML file, with a corresponding class to program everything inside the .XML file. I was following an online tutorial [CLICK HERE][3] Obviously it was over 2 years ago. Android Code has changed since

Android Actionbar set width to the tabs

允我心安 提交于 2020-01-21 07:04:14
问题 Currently I'm busy on a WHMCS app for my company. As navigation I want to use the Tab functionality in the actionbar. However, how can you edit the width of a tab? I need 5 together on one screen without the need to scroll. I already tried it with some styles like this: <style name="AppBaseTheme" parent="android:Theme.Light"> </style> <style name="AppTheme" parent="AppBaseTheme"> <item name="@android:attr/actionBarTabStyle">@style/tab_nav</item> <item name="android:actionBarTabTextStyle">

Open child activity in Tab host android

不羁岁月 提交于 2020-01-19 04:06:32
问题 My Tab_Bar.class define define Tabs How I can open child activity I am using only one single Tab_bar.class for Tab Host public class Tab_Bar extends TabActivity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.tab); setTabs() ; } void setTabs() { addTab("My Profile", R.drawable.home_normal, MyProfile.class); addTab("Search", R.drawable.search_normal, JobSearch.class); addTab("Saved Jobs", R.drawable.starred, Saved_jobs.class);

Open child activity in Tab host android

老子叫甜甜 提交于 2020-01-19 04:05:10
问题 My Tab_Bar.class define define Tabs How I can open child activity I am using only one single Tab_bar.class for Tab Host public class Tab_Bar extends TabActivity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.tab); setTabs() ; } void setTabs() { addTab("My Profile", R.drawable.home_normal, MyProfile.class); addTab("Search", R.drawable.search_normal, JobSearch.class); addTab("Saved Jobs", R.drawable.starred, Saved_jobs.class);

Android does not show tabs

北城余情 提交于 2020-01-17 13:53:31
问题 I am in a process of changing home activity to include tabs. I use https://github.com/saulmm/CoordinatorExamples as a source. For unknown reason I do not see the tabs in my AppBarLayout . I can see the Fragment content but tab headers are not displayed at all. I use appcompat-v7:23.3.0. Shortened layout: <android.support.design.widget.CoordinatorLayout <android.support.design.widget.AppBarLayout <android.support.design.widget.CollapsingToolbarLayout <ImageView .. <android.support.v7.widget