android-tablayout

Layout fields of fragment are NULL on initialization

吃可爱长大的小学妹 提交于 2019-12-05 11:33:18
I have issue with passing data to fragments. It crashes 0.1% of all times on production. Let's say on 100k opening of activity it happens 100 times. It looks like not very often, but it very bothering me and I think that I am doing something wrong with fragments initialization with data. The thing is, that I create fragments only one time, and all other times I need to pass data to them I am doing it next way: myFragmentInstance.setData(Object someData); And crash happens because it tells that those view elements in fragment are not found and they are NULL, but everything should be fine if I

Change ViewPager Fragment From Child Fragment

心已入冬 提交于 2019-12-05 11:28:16
I have a ViewPager using a TabLayout with several fragments. I would like to click a button from one of the ViewPager fragments and direct the user to another tab/fragment using the tab name. When the button is clicked, I would like the TabLayout to change as well as show the fragment associated to that tab. I would also need to send additional data with the request to show on the new fragment. I don't have access to the ViewPager setCurrentItem(int index). Ideally I would like to communicate with the parent to complete the request. You should write a method in the parent (containing the

How can I set the height of tabs in Android a TabLayout?

老子叫甜甜 提交于 2019-12-05 09:36:45
I Have this TabLayout in Android and wanted to make the tabs a little heigher than the default (48dp) <android.support.design.widget.TabLayout android:id="@+id/contentTabs" android:layout_width="match_parent" android:layout_height="wrap_content" style="@style/Theme.Zhaw.TabLayout" app:tabMode="fixed" app:tabGravity="fill"/> Here is the Style Theme.Zhaw.TabLayout: <style name="Theme.Zhaw.TabLayout" parent="Widget.Design.TabLayout"> <item name="tabIndicatorColor">@color/text_white</item> <item name="tabIndicatorHeight">4dp</item> <item name="tabPaddingStart">6dp</item> <item name="tabPaddingEnd"

Scroll both view pager and recycler view in single scroll

风格不统一 提交于 2019-12-05 06:18:39
问题 I'm developing app which has 4 tabs with view pagers. tab1 has scroll view and within the scroll view i have another tab layout with view pagers... When i full swipe tab1 i want recycler view within sub tab1 also to scroll when it reaches top.. currently i need to scroll seperately for scroll view and for recycler view.. Here is the Image of my app requirement... Here is my xml for Main tab layout: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http:/

Tablayout+view pager is not displaying the fragment in position 0

我与影子孤独终老i 提交于 2019-12-05 04:22:36
问题 My application has 2 tabs with two different layouts. when i run the application, the fragment which is supposed to be shown in tab1(position 0) displays in tab2, and the fragment which is supposed to be in tab2(position 1) is not displaying. Also when i swipe the screen the tab focus is not changing in the tablayout I have given my code below MainActivity.java public class MainActivity extends AppCompatActivity implements TabLayout.OnTabSelectedListener { TabLayout tabLayoutTL; TabLayout.Tab

How to make tab title alignment to left in TabLayout in Android

送分小仙女□ 提交于 2019-12-05 04:08:52
I can't seem to align my tab titles to the left, inside my TabLayout. At the moment, the titles are centered. Here is what I want to achieve. And this is what I have at the moment. The code I'm using is as follows: <android.support.design.widget.TabLayout android:id="@+id/tabs" app:tabGravity="fill" app:tabMode="fixed" app:tabTextColor="@color/white" app:tabSelectedTextColor="@color/white" app:tabIndicatorColor="@color/white" android:background="@color/slate_grey" android:layout_width="match_parent" android:layout_height="wrap_content"> </android.support.design.widget.TabLayout> add app

TabLayout gravity center is not working

大城市里の小女人 提交于 2019-12-05 03:13:28
I have a TabLayout, where I want the tabs to be displayed in the center of the screen. Below is the XML for my TabLayout. <android.support.design.widget.TabLayout android:id="@+id/tabs" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center" android:background="@color/white" app:tabGravity="center" app:tabIndicatorColor="@color/about_tab_selected" app:tabIndicatorHeight="4dp" app:tabMode="scrollable" app:tabPaddingEnd="20dp" app:tabPaddingStart="20dp" app:tabSelectedTextColor="@color/about_tab_selected" app:tabTextAppearance="@style

Navigation Drawer and VideoView in android

人盡茶涼 提交于 2019-12-04 22:45:39
I am using a navigation drawer plus a tablayout. I have a video in my tab which was not visible at first, but I can hear the sound. Once I set video_view.setZOrderOnTop(true); and I can also see the video, but this causes an issue with navigation drawer. When I slide it, the video doesn't hide behind the navigation drawer as do all other elements. If I don't use video_view.setZOrderOnTop(true); then my drawer is works fine. main_activity.xml <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/drawer_layout" android:layout_width=

Android TabLayout does not display contents anymore as soon as fragment is switched

落花浮王杯 提交于 2019-12-04 19:17:33
问题 I am using a navigation drawer in my project, with 5 fragments in it. In one fragment I have the in the design support library introduced TabLayout, which includes 2 Fragments. All works fine, except when I leave the fragment which has the TabLayout and switch back to it, all the content is gone. In each fragment in the TabLayout I have a SwipeRefreshLayout with a ListView in it, they both don't display anything upon switch. I also noticed the TabLayout starts acting strange. by strange I