android-tabs

Access Parent Fragment method from Child Fragment

痞子三分冷 提交于 2019-12-12 11:29:55
问题 I'm trying to access from Map Fragment to myfunction() situed in the Parent Fragment Tabs . I tried the following line Tabs parentFragment = (Tabs) getParentFragment(); however parentFragment is null. I read all topics concerning this subjects but none of them helped me... (after maybe I misunderstood them). I have the following files : The Fragment from which I want to call the Parent method. public class Map extends Fragment { View rootView; @Override public View onCreateView(LayoutInflater

How do I disable sliding tabs when in contextual action bar, by making the tabs not clickable/swipeable?

旧城冷巷雨未停 提交于 2019-12-12 11:21:51
问题 I have a toolbar, to which I have attached a sliding tab layout, using these two classes: SlidingTabLayout, SlidingTabStrip. When I long press an item, the contextual action bar appears and overlays the toolbar, using <item name="windowActionModeOverlay">true</item> in my styles.xml. The problem is that the Tabs are still clickable, and swipable. I have tried setClickable(false) , which didn't work. How do I make the tabs not clickable, so that I can then change the "state look" of the tabs

Android: ActionBar, TabListener and support.v4.Fragment

蹲街弑〆低调 提交于 2019-12-12 09:38:13
问题 I'm building an app with MainActivity which extends FragmentActivity and has an ActionBar with three tabs. At each tab I would like to attach a ParentFragment which should control the swipe among internal pages. The result should be that pressing the tabs the user should change from the different instances of the ParentFragment and swiping he should change among the TextViewFragments inside each ParentFragment . Now I can perfectly switch among the three tabs, but the problem is that the

BadgeView and SlidingTabStrip clicking error

﹥>﹥吖頭↗ 提交于 2019-12-12 08:16:55
问题 i am using sliding tab from: https://developer.android.com/samples/SlidingTabsBasic/src/com.example.android.common/view/SlidingTabLayout.html and BadgeView from: https://github.com/jgilfelt/android-viewbadger i just add these lines of code to SlidingTabLayout to access each tab: public SlidingTabStrip getTabStrip() { return mTabStrip; } so in fragmenta i can use below code to add badgeview to each tab: public class FragmentA extends Fragment { @Override public View onCreateView(LayoutInflater

Android: How to change android:fillcolor with selector in one Vector Drawable xml

≯℡__Kan透↙ 提交于 2019-12-12 07:27:29
问题 Tab Icons: My current method is to create two files (ic_list_selected_24dp.xml and ic_list_unselected_24dp.xml; they are basically the same but only the android:fillColor='Color HEX CODE' are different), and then create a selector (selector_tabitem_list.xml) to change the drawable color when the state is changed. // @drawable/selector_tabitem_list.xml <selector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"> <item android

Grab TabText in Fragment

杀马特。学长 韩版系。学妹 提交于 2019-12-12 05:04:32
问题 I have an ActionBar that contains 11 tabs and 1 fragment. I also have a ViewPager to display the fragment(s). When a tab is clicked it creates the same fragment. The tabs display dates so they change everyday. What I need is to send the text of the tab (ie. .getTabText()) to the fragment, this will change the content of the fragment. I am having so much trouble trying to figure out how to do this. Here is all my code: public class MainActivity extends FragmentActivity implements ActionBar

How to set inactive tab colour for BottomBar

孤街浪徒 提交于 2019-12-12 03:48:42
问题 I am trying to set the colour for the inactive tabs on BottomBar but can't find any method for doing so. I have set the background colour for the bar using this: mBottomBar.getBar().setBackgroundColor(getResources().getColor(R.color.colorPrimary)); and would like to set the tabs to appear as white even when not in use, however don't seem to be able to do it: I am trying this method, but it doesn't work: mBottomBar.mapColorForTab(0, "#ffffff"); on all the four tabs e.g. .mapColorForTab(1, "

Can I embed scrollable tabs inside the action bar?

丶灬走出姿态 提交于 2019-12-12 01:29:36
问题 I'd like to have a layout where screen real estate is important on smaller screens, but I'd like users to be able to swipe between exactly two tabs. On these smaller screened devices, I don't want to waste an entire row with a scrollable tab widget like this: but fixed tabs offer no indication to users that they can swipe: Users will typically need to view both tabs to complete the task. Is there any way presently to embed tabs with support for "swipe to switch tabs" inside the main action

Android studio - is possible to add tabs pointing to fragments from designer?

半城伤御伤魂 提交于 2019-12-11 20:39:29
问题 i'm trying to add tabs for main activity which should pointing to several fragments. Is it possible from Android Studio designer? I added into my activity layout tabhost like on image below, but on real device is not displayed. How can i solve it? Thanks for any advice. 回答1: I will reduce my example on one Button, you should be able to multiply it. I also cut out unneccessarry stuff like margins etc... If you have problems, just tell me and I will gladly help you out: MainActivity.java -

Titles in TabLayout donsen't appear

谁都会走 提交于 2019-12-11 15:48:29
问题 guys I have a trouble in Android, my code compiles and but not work all fine! I try to do a TabLayout with ViewPager but the text donsen't appear. This is the structure of the code: I build this based on DrawableLayout own created by Android Studio, so lets check my code: In Main Activity: The Library is allready imported. import android.support.design.widget.TabLayout; // Tabs and ViewPager TabLayout tabLayout = findViewById(R.id.tabs); ViewPager viewPager = findViewById(R.id.viewpager);