android-tablayout

How do you create an Android View Pager with a dots indicator?

天大地大妈咪最大 提交于 2019-12-17 02:39:15
问题 Probably many of you (as me), have problem with creating ViewPager with bottom dots, like this: How do you create such an Android ViewPager? 回答1: All we need are: ViewPager, TabLayout and 2 drawables for selected and default dots. Firstly, we have to add TabLayout to our screen layout, and connect it with ViewPager . We can do this in two ways: Nested TabLayout in ViewPager <android.support.v4.view.ViewPager android:id="@+id/photos_viewpager" android:layout_width="match_parent" android:layout

how can I add the viewpager and tablayout under the collapsing toolbar layout

元气小坏坏 提交于 2019-12-14 03:51:07
问题 I tried all solution for this problem in stackoverflow but I got nothing helpful . First of all , I want to achieve layout like this or similar to it : And according to some question in stackoverflow like this I'm able to achieve this layout : with this xml file : <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/main_content" android:layout_width="match_parent"

Android : Update Tab Layout(fragments) textviews from an activity

青春壹個敷衍的年華 提交于 2019-12-13 23:17:54
问题 I'm creating tab view using tablayout and viewpager. I use one fragment for each tab. And in my MainActivity, I'm getting some values from a device through bluetooth. The values are received as a single string, and I split it and sets it to corresponding tabs. But I'm getting a NullPointerException when I try to call the setText method for the textview in fragment from my activity. Can anybody show me how to update the textviews of each of the fragments from my MainActivity?? Like, if i

Tablayout title aren't visible in Android

假如想象 提交于 2019-12-13 02:16:52
问题 As the title explain, I am not able to see the title in the tablayout. I have followed a tutorial on youtube to create this swipable tabs. Here the link of the tutorial I have followed all the instruction shown in the video but I couldn't get the similar results. Here is my code MainActivity.class package com.example.kuro.bloodpressure; import android.annotation.TargetApi; import android.app.Activity; import android.app.AlertDialog; import android.content.DialogInterface; import android.os

Can the tab selection indicator of TabLayout be pinned to the top of the screen while scrolling?

我的未来我决定 提交于 2019-12-13 01:53:44
问题 I am investigating the way to pin the tab indicator of TabLayout in CoordinatorLayout while scrolling down. If I add scroll|enterAlwaysCollapsed flag to the TabLayout , then the tablayout itself is dissappeared while scrolling down. I want tab indicator bar be pinned to the top of the screen. Is there a way to implement this? 回答1: I think you should just have no flags at all. Your layout should be something like: <CoordinatorLayout> <AppBarLayout> <Toolbar app:layout_scrollFlags="scroll

Android TabLayout on the bottom of the screen

主宰稳场 提交于 2019-12-12 17:24:34
问题 I have this generated XML code when I started a new Tabbed Activity: <?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.CoordinatorLayout 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:id="@+id/main_content" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true" tools:context="eis1617.muellerkimmeyer.app

CollapsingToolbarLayout: Keep Toolbar but hide TabLayout with quick return

淺唱寂寞╮ 提交于 2019-12-12 14:22:31
问题 I want the Toolbar to always be visible and have the TabLayout get scrolled away and quick return but this combination seems impossible. <CoordinatorLayout> <AppBarLayout> <CollapsingToolbarLayout layout_scrollFlags="scroll|exitUntilCollapsed"> <TabLayout/> <Toolbar layout_collapseMode="pin" /> </CollapsingToolbarLayout> </AppBarLayout> <ViewPager/> </CoordinatorLayout> This makes my Toolbar not scroll away, but it makes the TabLayout only return when scrolled to the top of the list. Changing

OnBackpressed get empty view on tablayout

橙三吉。 提交于 2019-12-12 11:13:34
问题 Hey guys please look into the matter. I am stuck in solving this problem. I have set tabs in fragment using TabLayout and ViewPager . The problem is when i move to next fragment and then i press back button i get empty tabs view. Here I am attaching my code. home.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout 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

TabLayout color of unselected tab underline

扶醉桌前 提交于 2019-12-12 10:23:11
问题 In this picture, in tablayout, selected tabbar underline color is purple, and text. I search of unselected tabbar, but I couldn't find unselected tabbar underline. I want change the color when I select some tab, change the unselected tabbar underline color. If you know about this, would you help me? 回答1: Create an xml file inside your drawable folder custom_indicator.xml <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <!--

Separate Back Navigation for a Tabbed View Pager in Android

血红的双手。 提交于 2019-12-12 08:34:55
问题 What I want. In a tab sliding menu context, I want to replace a fragment to another inside a tab, and maintaining the tab menu, and also the current tab. When sliding to another tab and returning to original, I want the last fragment to be displayed. For example, I have tab_a with Fragment_1 , tab_b with Fragment_4 and tab_c with Fragment_7 . Now I want a button in Fragment_1 that opens me Fragment_2 , but I want to be able to swipe to the fragments of the tab_b and tab_c . And when I return