Android: ActionBar with fixed bottom layout - android

I am trying to make an app which the main screen is an tabbed interface, and bellow the tab control there is a fixed strip of controls.
My first try, was adding into my XML another linear layout bellow the android.support.v4.view.ViewPager and setting actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); . This hides the layout at the bottom.
When I try NAVIGATION_MODE_STANDARD I see the layout at the bottom, but the app crashes when I switch tabs.
I found something similar in Appolo Music, however I did not understand were the player strip is defined (full code is here: https://github.com/CyanogenMod/android_packages_apps_Apollo)
EDIT:
I found using the Hierarchy viewer that the extra layout gets deleted on runtime. This is interesting.

Related

floating action button stays extended on changing tab in app

I've used a FAB (Floating action button) in my app.
It stays Extended when i click on the other parts of page or changing tabs.
How can i make it embed on changing tabs or clicking on the other parts?
May be you have done mistake in your Layout XML file. Check the FAB Width & Height Property. it should be wrap_content in both.
also if you share your code we can give you proper guide.

Android sherlock actionbar tabs alignment

I'm using Android sherlock fragment tabs for creating a layout for swiping the tabs.
Now what I want to do is put the tabs below a relative layout , but the tabs headers are appearing at the top while it's content is appearing where it should be.
You may use standalone tabs widget like https://github.com/JakeWharton/Android-ViewPagerIndicator
or move existing tabs using technique (really hack) described at http://kriomant.blogspot.ru/2013/08/navigation-drawer-tabs-overlap.html
But in case of hack current tab indicator will still be drawn at the bottom. I didn't investigate whether it is possible to move it.

How can I add tabs to a view outside the action bar?

I have a layout where I need tabs inside a sub-layout, not in the action bar. I.e., The tabs do not apply to the entire screen display, only to one of the panes.
How can I do this in Android 4.0+?
You can do this using the support library and a FragmentTabHost. Google has an example here. In your layout file you can embed the android.support.v4.app.FragmentTabHost that's shown in the example inside another layout, such as a pane.
Another option is to use scrollable tabs. They also can be imbedded anywhere in a layout. Google gives a code example here. The view that you will imbed in your pane is the android.support.v4.view.ViewPager with a android.support.v4.view.PagerTitleStrip as it's subview. This example also has a sample project that you can download (the example project doesn't have the scrollable tabs imbedded inside another layout, but it's a good starting point).

Creating an Android Nav Bar that replaces button with image when that activity is active

I am looking to create a Nav Bar in my Android application that functions very similar to the Nav Bar used by the Netflix app. There will be 4 buttons aligned horizontally. When one of those buttons is selected, the appropriate activity loads and that button is replaced by an image.
There are multiple ways I can achieve this, but since I am new to programming for Android, I figured I'd ask the community first. I list the first two that come to my head below.
Create a Linear Layout and define a separate layout for each activity. The Layout would include two more linear layouts, a horizontal linear layout for the nav bar and a vertical layout for the content.
Create a custom ui component named nav bar that extends a linear layout (based upon earlier threads I have seen about nav bars on here). Inflate that layout for each activity, then make a framelayout that overlays an image on top of the active button (the button that was just pressed). Then create onButtonClick listeners for each button except for the active button.
I'm not sure if there is a better way to achieve this and I am open to any suggestions. Any feedback would be great.
I'm not sure how the netflix app looks, but you might want to check out ye good olde tab-layout? ( http://developer.android.com/resources/tutorials/views/hello-tabwidget.html )
Also be sure to take a look at the android design page: http://developer.android.com/resources/tutorials/views/hello-tabwidget.html

Custom Component in android

I have created custom component with a Button Bar on the Bottom of
the screen and a Title and status bar on the top of the screen. I want
to include this custom component in every one of my Activities. Now,
in a any given activity, how do I go about adding content on the
screen (say a button in the middle of the screen) in a addition to my
custom component thats ever present?
How about adding a base layout with can contain the header and footer that you use everywhere and then have a stub in the middle that you can inflate with whatever you like?
I think that will solve your problem.
You can read about ViewStub here:
http://android-developers.blogspot.com/2009/03/android-layout-tricks-3-optimize-with.html

Categories

Resources