In the android design guidance there is an image of "ActionBar calendar spinner":
Is there a code realization for this widget (if exists)? Is it a native SDK widget or just design pattern?
I guess the native calendar app is not open source, so i doubt that you'll find the source code somewhere around the web.
But you probably can solve that by creating a custom adapter and inflating different layouts for getView() (current/selected item) and getDropDownView() (spinner rows).
Edit: I just saw the calendar app became open-source. Here is the git-Link: https://android.googlesource.com/platform/packages/apps/Calendar.git
I would be curious too whether the extended ActionBar list navigation is a pattern or a custom widget. Would you post your results after checking out the source?
Quite late for the OP now, but thought that i could help by-passers.
You can achieve a similar look and functionality by modifying the code provided in this tutorial http://www.androidhive.info/2013/11/android-working-with-action-bar/ .
Just read the section about the actionBar Spinner. Than modify the related methods to include two textviews (or one textview with tabbed space to achieve Day tab Dec 1) instead of icon/textview.
Related
I have been doing a small research on UI designs for Android for the last few weeks. My main concern right now is the action bar along with tabs. I believe the default android implementation takes to much room on the screen.
Recently I took a look at the Flickr app and I really like how they do this but I am not sure how to implement tabs this smoothly inside the action bar itself.
All help / ideas are appreciated.
Thanks in advance.
Screenshot of the action bar can be found here:
https://dl.dropboxusercontent.com/u/242865/Screenshot_2014-11-11-11-04-05.png
Check out this library on github.
It's an Android Library to help you create actionbar tabs like Capitaine train app by Cyril Mottier.
You have to set a customview in your actionbar and use something like ViewPagerIndicator
http://viewpagerindicator.com/
To setup a custom view in your actionbar just use setCustomView but remember to enable the display of custom view first.
Take a look at this
http://www.jfarrell.net/2013/10/customizing-action-bar-in-android.html
I am currently trying to get the look of my app right. But I am having problems figuring out how to even set up a way to change themes. For one thing, is there even a way to change styles through code? I checked the method list and I saw nothing. This leads me to my actual question; is there a way that, like CSS, in which you style the parent, and then have it trickle down but also changed depending on the View? I looked at the Android docs, and they did not show any examples of this. Hopefully someone can give me an idea as to how to accomplish this, or if its not possible, to let me know that as well. Thanks in advance.
You should be able to do this using styles and themes. I've implemented this using Jake whartons Sherlock action bar. (I'm not certain if it's necessary) It involves using the comparability library which gives you the ability to use fragments and loaders as well. Look at his democode at http://actionbarsherlock.com/download.html. Look for where themes are mentioned and you will find the information you need. In the demo app you can change the theme in the top right corner and see how it affects the activities look and feel. It also shows many of the features available and the code to write them. I have found this an invaluable resource and it should show you how to theme your app.
As the title suggests I want to create a custom title bar for a PreferenceAcitvity.
I need to add a summary below the title. Currently it will only display a title, but I need a sub-title, just like any Preference can have a summary.
I have read loads of questions here, like this and this, but these all do something different; it's not possible to include a summary for the title with the first method. Creating a custom layout for every Preference also doesn't seem the wisest option, and is loads of meaningless work (I have tons of PreferenceActivity's. I am looking into extending something.
Also, I want to keep the default behaviour as much as possible, so I am looking into ways of adding a TextView to the default layout located in android-sdk-windows\platforms\android-16\data\res\layout\screen_title.xml
So I thought I would apply this layout to the method in the second Q, but now I run into the problem of resource id's used in the screen_title.xml file that aren't public.
I'm running out of ideas...anyone got some fresh ones?
EDIT:
I found a solution thanks to the accepted answer below.
To clarify a bit further: the method getSupportActionBar() in the answer isn't in the SDK, but comes from ActionBarSherlock.
This is a compatibility library to enable the ActionBar and FragmentActivity (amongst other things) on pre API 11 applications/ devices. It's quite a heavy library, around 11mb, so you will have to think about if it's worth adding 11mb to your application just to have a summary/ subtitle in your preference screen's. On the other hand, this ofcourse also allows you to implement the other features of the library, such as actually creating an action bar (and or menu).
If you are talking about Actionbar then you can do this:
ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayShowTitleEnabled(true);
actionBar.setSubtitle("Test Subtitle");
I've been updating an Android app today which so far had a single TableLayout-based View. Now, I'd like to duplicate that View with another set of backing data, and use horizontal swiping to switch between both. At some point I'd also like to add a third "page" with a different TableLayout.
I haven't really found any good ways to get this going. I've been looking at http://developer.android.com/training/implementing-navigation/lateral.html, and I actually copied the code fragment for the Tabs Pattern with NAVIGATION_MODE_TABS. That results in a little dropdown widget being added to the View title in the action bar, but clicking it doesn't show the tabs I set up (with actionBar.addTab()). I'm also not sure how to set up the view (XML) code to stick the TableLayouts in there.
I should mention that I don't have to care for pre-4.0 Android for this, so compatibility is not (much of) an issue.
Try to Use ViewPager Widget you can find useful links on the web, this widget handle the horizontal swiping between views.
http://android-developers.blogspot.com/2011/08/horizontal-view-swiping-with-viewpager.html
https://github.com/JakeWharton/Android-ViewPagerIndicator
http://blog.stylingandroid.com/archives/537#
I haven't really found any good ways to get this going.
Try ViewPager. Here is an Android Developers Blog post on ViewPager: http://android-developers.blogspot.com/2011/08/horizontal-view-swiping-with-viewpager.html
Here is a small sample app using ViewPager: https://github.com/commonsguy/cw-omnibus/tree/master/ViewPager/Fragments
None of the other answers ended up helping much. However, this one is pretty good:
http://thepseudocoder.wordpress.com/2011/10/05/android-page-swiping-using-viewpager/
How can I build a view like this?
Maybe first row image and then another image for the spinner and then button for the preference and then button for the email.
Second row: two buttons with two images.
Is there a simple way?
This is a simple ActionBar pattern. Please refer to the ActionBar API documentation in the Android docs, and the ActionBarSherlock library which will allow you to use this back to 2.1