android-tabs

Change image on Tab in TabLayout when Selected

回眸只為那壹抹淺笑 提交于 2019-12-06 03:51:20
问题 I am using Design TabLayout, <android.support.design.widget.TabLayout android:id="@+id/tabs" android:layout_width="match_parent" android:layout_height="wrap_content" app:tabBackground="@color/ColorPrimary" app:tabIndicatorColor="@color/orange" app:tabIndicatorHeight="3dp" /> I have added customview to Tabs <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content"

How to create Toolbar Tabs with ViewPager in material design

微笑、不失礼 提交于 2019-12-06 03:19:38
问题 Anyone know anything about how tabs are done in API 21/AppCompat Toolbar? A lot of materials and articles what I found were old. They used old methods with ActionBar which don`t work now. At this moment I just created toolbar and have no ideas about toolbar tabs. So can anyone give examples or articles about how to make toolbar tabs with viewpager? 回答1: Anyone know anything about how tabs are done in API 21/AppCompat Toolbar? There are no Toolbar tabs. The pattern of having tabs in the action

Android Tab Layout inside Fragment

橙三吉。 提交于 2019-12-05 23:45:10
I have a main Activity with a navigation drawer and I'm trying to realize a layout like Play Music App with tabs. The MainActivity has a FrameLayout like a container: <FrameLayout android:id="@+id/container" android:layout_width="match_parent" android:layout_height="match_parent" /> and I want to put inside the @+id/container a Fragment with Tabs. How's the best way to do this? I thought I can create a MyFragment which extends Fragment and implements TabListener. The associated layout could be like <?xml version="1.0" encoding="utf-8"?> <android.support.v4.view.ViewPager xmlns:android="http:/

Fragment disappears from backstack

為{幸葍}努か 提交于 2019-12-05 13:30:23
Why does FragmentTwo disappear from the backstack in the following situation: My app has a Fragment called FragmentOne in an Activity . FragmentOne holds a Button . When clicked, it launches FragmentTwo , which is added to the Fragment backstack. FragmentTwo has a Button , which when clicked adds two tabs to the ActionBar linked to two Fragments , FragmentThree and FragmentFour . FragmentThree is visible. If I now click the back button, I expected to see FragmentTwo . Instead, I see FragmentOne . Where did FragmentTwo go? Before I override onKeyDown() and start implementing my own backstack

How does action_bar_embed_tabs exactly work in Android?

穿精又带淫゛_ 提交于 2019-12-05 13:15:13
I have tabs in an actionbar. On large screens the tabs are embed to the actionbar but on small screens the are not. I want to control the tabs manual so i can separate the tabs from the actionbar. I tried to set abs__action_bar_embed_tabs but that didn't work <resources> <bool name="abs__action_bar_embed_tabs">false</bool> </resources> Atul O Holic I know this is an old post, however I would like to add a solution using action_bar_embed_tabs for future readers. Create the below method (do take care of the imports), public static void setHasEmbeddedTabs(Object inActionBar, final boolean

How can I enable actionbar tabs in a fragment?

二次信任 提交于 2019-12-05 10:33:30
I switched from Activity to Fragment and now I am getting the this error java.lang.IllegalArgumentException: Tabs not supported in this configuration from the following line actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); How can I make these tabs work in a fragment with base ActionBarActivity? rest of the code @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { act = (ActionBarActivity )getActivity(); final ActionBar actionBar = act.getSupportActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); actionBar

BadgeView and SlidingTabStrip clicking error

自古美人都是妖i 提交于 2019-12-05 07:48:43
问题 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: ActionBar, TabListener and support.v4.Fragment

梦想与她 提交于 2019-12-05 05:51:55
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 ParentFragment is not correctly shown, it seems it's not even created because I can't even see the onCreate

Switching between fragmentTabs giving unexpected results

ε祈祈猫儿з 提交于 2019-12-05 01:38:09
问题 I am trying to implement FragmentTabs as illiustrated in http://developer.android.com/resources/samples/Support4Demos/src/com/example/android/supportv4/app/FragmentTabs.html. Everything went well until i did this: I started lots of different fragments from one tab like: tab1-->fragment1--->fragment2--->fragment3 tab2 But when i switched to tab2 and again came back to tab1, I got fragment1 screen not fragment3(i.e. I have 3 fragments in first tab and while i am on 3rd fragment and I come again

Android passing ArrayList<Model> to Fragment from Activity

安稳与你 提交于 2019-12-05 00:35:37
问题 Hi I want to send the data ArrayList<Division> to Fragment class ListContentFragment . In MainActivity I am making a network call to get the data( JSON ) and then parsing it to create ArrayList<Division> , now i want to populate the list view with the data i received (now in ArrayList<Division> ) MainActivity protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Adding Toolbar to Main screen Toolbar toolbar =