android-tablayout

Android Design Support Library TabLayout using custom tabs layout but layout wrapping the tabs

ぃ、小莉子 提交于 2019-12-18 19:05:51
问题 In tab custom layout I set its parent element to match_parent and set its background color. When I run it tabs are shown custom layout wrapping the elements imageview and textview. I want this custom layout will fill the tab without any space between tabs. Check output here: private void setupTabLayout(ViewPager viewPager, ViewPagerAdapter viewPagerAdapter) { TabLayout tabLayout = (TabLayout) findViewById(R.id.tab_layout); tabLayout.setupWithViewPager(viewPager); int length = tabLayout

Toolbar and TabLayout is not visible on Android 4.4 devices

我只是一个虾纸丫 提交于 2019-12-18 16:25:28
问题 I was trying to implement Toolbar and TabLayout using google design library by referring to [http://blog.grafixartist.com/material-design-tabs-with-android-design-support-library/] [blog]. Output works as expected on Lollipop devices but it doesnot show ToolBar and TabLayout on Kitkat devices. But i can still swipe through 3 fragment as expected on kitkat device as well. How come same code written using google support libraries works differently on different devices! I tried referring to

Android - Remove shadow between Toolbar and TabLayout

折月煮酒 提交于 2019-12-18 12:31:35
问题 I'm trying to make a layout with CollapsingToolbarLayout . But I do not get one thing. I want to remove the shadow between Toolbar and TabLayout . I've tried several ways and I have not managed to remove the shadow. Can anybody help me? Thank you <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"

Android TabLayout custom indicator width

余生长醉 提交于 2019-12-18 12:00:31
问题 I want to reduce width of indicator - for example, make it's width not whole tab width, but 1/2 of tab width. That's all I need to do, so I don't want to download some custom library and search where I can do this. Is it a way to do this or I should write such view by myself? 回答1: Try this. public void setIndicator (TabLayout tabs,int leftDip,int rightDip){ Class<?> tabLayout = tabs.getClass(); Field tabStrip = null; try { tabStrip = tabLayout.getDeclaredField("mTabStrip"); } catch

Align Icons in Tab Layout To The Left

人盡茶涼 提交于 2019-12-18 04:55:11
问题 Hello I have created a tab layout in my activity. This is the main .xml file: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout android:id="@+id/main_layout" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.xxxxxx.eventmanager.EventDetailsActivity"> <android.support.design.widget

Align Icons in Tab Layout To The Left

冷暖自知 提交于 2019-12-18 04:55:01
问题 Hello I have created a tab layout in my activity. This is the main .xml file: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout android:id="@+id/main_layout" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.xxxxxx.eventmanager.EventDetailsActivity"> <android.support.design.widget

Tab icon and text both using android design support library

三世轮回 提交于 2019-12-17 16:46:09
问题 ]1]1i used android design support tablayout and i got both icon and text on tab .. i used a customtabview to align icon and text vertically..And i want to change the color of the icon and text when selected/unselected. i made selector file for different tab icon..but the thing is when i run the project the first default tab is unselected i want them to get selected by default..and if i go to other tab and then swipe back to the first tab it works perfectly fine..the main problem is i cant

Android Tab Layout tabs with round corners

本小妞迷上赌 提交于 2019-12-17 16:08:34
问题 This type of Question has already been asked before but not got any proper,working solution so I am again posting this question.Sorry for asking again and wasting your time. Please give some working solution. Or let me know if I am doing anything wrong. Thanks in advance. Expected Tabs: But coming Like: Coming Tabs On page Load tabs are coming like "Expected Tabs" image but after selection coming like "Coming Tabs" image. MainXML code: <android.support.design.widget.TabLayout android:id="@+id

error can not resolve symbol TabLayout and 'design

安稳与你 提交于 2019-12-17 14:04:08
问题 Please help: I got error when import android.support.design.widget.TabLayout It say "can not resolve symbol 'design' My build.gradle: compileSdkVersion 26 buildToolsVersion "26.0.0" dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { exclude group: 'com.android.support', module: 'support-annotations' }) compile 'com.android.support:appcompat-v7:26' compile 'com.android.support.constraint:constraint

Disable TabLayout

不羁的心 提交于 2019-12-17 07:17:10
问题 I'm using the new class provided by the design library : TabLayout. And I want in specific cases that the one I'm using can't change tab anymore. I manage to disable swipe on its viewpager but I can't figure out how to disable the change of page by clicking on tabs. Thank's in advance. 回答1: I had the same problem and I solved it disabling touch event on tabs with the following code: LinearLayout tabStrip = ((LinearLayout)mTabLayout.getChildAt(0)); for(int i = 0; i < tabStrip.getChildCount();