android-tablayout

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

TabLayout tab selection

你。 提交于 2019-11-26 15:09:51
问题 How should I select a tab in TabLayout programmatically? TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs); tabLayout.setupWithViewPager(viewPager); 回答1: If you know the index of the tab you want to select, you can do it like so: TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs); TabLayout.Tab tab = tabLayout.getTabAt(someIndex); tab.select(); This technique works even if you're using the TabLayout by itself without a ViewPager (which is atypical, and probably bad practice,

How to set android TabLayout in the bottom of the screen?

纵然是瞬间 提交于 2019-11-26 12:56:10
问题 My question is how I can set the new android material design TabLayout to be in the bottom of the screen, kind of like Instagram\'s bottom toolbar. If you have never seen Instagram\'s UI here is a screenshot of it : . If there is a better way of approaching this, please feel free to post it here (with a code example if possible), I will greatly appreciate it. Here is my code: activity_main.xml <android.support.design.widget.AppBarLayout android:layout_width=\"match_parent\" android:layout

Text size of android design TabLayout tabs

北城以北 提交于 2019-11-26 12:04:40
问题 I have difficulties changing the text size of the tabs of design library tablayout (android.support.design.widget.TabLayout). I managed to change it by assigning tabTextAppearance in TabLayout app:tabTextAppearance=\"@style/MyTabLayoutTextAppearance\" the following style <style name=\"MyTabLayoutTextAppearance\" parent=\"TextAppearance.AppCompat.Widget.ActionBar.Title.Inverse\"> <item name=\"android:textSize\">14sp</item> </style> but I have 2 side effects : 1) I lost the accent color of the

ViewPager + RecyclerView issue in android

三世轮回 提交于 2019-11-26 08:39:00
问题 Hi I have Tablayout with Viewpager and i am using Fragment for tablayout. Now in every Tablayout fragments I have Recyclerview and displaying items.Please See this my json response http://pastebin.com/nUswad9s here in \"typeMaster\": array i have categories \"typeName\": \"Dogs\", and i am displaying typenames in tablayout i have 4 tablayout, and inside typemaster i have subcategoreis named \"catMaster\": and i am trying to display catmaster data in recyclerview,but the issue is in every

Changing the background color of a Tab in TabLayout (Android design support library) doesn&#39;t occupy the entire tab space

和自甴很熟 提交于 2019-11-26 07:29:28
问题 I have a TabLayout (design support library) which is tied up to a ViewPager containing three tabs. I have designed a custom layout and set that to each tab in the TabLayout. I have been trying to change the background color of the currently selected tab. The color only wraps up around the text in the tab but doesn\'t occupy the entire tab space. Below are the code snippets of my activity and the custom layout file. Activity code public class CustomTabLayoutActivity extends AppCompatActivity {

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

雨燕双飞 提交于 2019-11-26 05:21:15
问题 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