I have divided my layout into half, left side is having all the buttons.
Right side of the layout should show the button clicked activity.
I am using android 2.2, this is particularly for extra large screens as in small screens main activity would have just buttons,clicking on buttons would take to new activity but for extra large screens all of these images and buttons looks very small, so now divided the layout left for buttons and right for rendering those particular activities.
Any pointers or code examples would be really helpful.
Tried fragments in android 2.2 but fragments only work after android 3. So looking forward to your reply.
thanks.
The Fragments api was backported almost immediately after it was released. Use the information in the following blog post from the Android Developers blog to use this library in your apps that support API versions less than 3.0
http://android-developers.blogspot.com/2011/03/fragments-for-all.html
EDIT
Here's a better link with pictures and more detailed instructions
http://mobile.tutsplus.com/tutorials/android/android-compatibility-working-with-fragments/
Related
Is there a library for creating Floating Action Buttons with labels (similar to the Evernote app)?
Evernote Screenshot
The popular libraries seem to be
https://github.com/futuresimple/android-floating-action-button (closest to what I want... ability to expand hide "sub" actions)
https://github.com/makovkastar/FloatingActionButton (Primary function is to hide/show with a scrollview, recyclerview, or listview)
https://github.com/oguzbilgener/CircularFloatingActionMenu (library which has been around pre-lollipop)
Neither of these, to my knowledge, have this capability. Before re-inventing the wheel, has somebody already done this?
This feature request ended up being implemented in https://github.com/futuresimple/android-floating-action-button. This includes labels on both the left and right sides.
If you're interested, see the discussion here: https://github.com/futuresimple/android-floating-action-button/issues/22#issuecomment-66155108
Disclaimer: I haven't used this (yet).
I'd recommend this library over others that I've seen.
Nowadays there are available techniques of manipulating behaviour of the view that enable you to program FloatinActionButton as you want and to have joy that you have made it by yourself!
Fade in/out FloatingActionButton while scrolling RecyclerView . DETAILS
Slide down/up , beside it blog says how to:
Expand floatingActionButton and show subFloatingButtons. DETAILS HERE
There is to much details, "how to do". Therefore I've attached just links to blogs. Anyway I encourage you guys to take a look at those blogs. You will have total control over your application. Currenty I use all solutions from both blog's. Enjoy!
Especially the last library you mentioned looks quite sophisticated. To my knowledge, you can set any kind of View you want to be shown as a Button.
This View could simply be a custom-view of yours that shows an image as well as a label.
In case anyone is still looking for this functionality: I made an Android library that has this ability and much more, called ExpandableFab (https://github.com/nambicompany/expandable-fab).
The Material Design spec refers to this functionality as 'Speed Dial' and ExpandableFab implements it along with many additional features.
Nearly everything is customizable (colors, text, size, placement, margins, animations and more) and optional (don't need an Overlay, or FabOptions, or Labels, or icons, etc). Every property can be accessed or set through XML layouts or programmatically - whatever you prefer.
Written 100% in Kotlin but comes with full JavaDoc and KDoc (published API is well documented). Also comes with an example app so you can see different use cases with 0 coding.
Github: https://github.com/nambicompany/expandable-fab
Library website (w/ links to full documentation): https://nambicompany.github.io/expandable-fab/
My application consists of tabs using Tabhost and Activity group. It is working well for now. However, I am told to extend the app to support tablet. The current app seems to work in tablet, with less space utilization. I am told to use split views in few screens.
As a result, I made a rigorous study on extending the design. One proposal is to use fragments. This eventually necessitates a major design change and consumes more time. The other one is to tweak the existing code to extend support which is far less recommended.
The app is aimed to support all Android versions above 2.2
Could anyone guide me a better solution?
EDIT:
I am already using new layout naming conventions.
layout-sw600dp
layout-sw800dp
For current smartphone version, say for instance, a screen has list view as
Item A
Item B
Item C
Tapping any item opens a new activity in the activity group showing the details.
But in tablet, the above two features are brought to a single layout using split view.
Item A |
Item B | Item details
Item C |
I am stuck with implementing the above feature. Can I use fragments inside ActivityGroup?
I have an existing app that is using a Dashboard style pattern where there's a main menu, and clicking icons on the main menu drive start different activities... In order to navigate to a different function, you need to go back to the Dashboard menu and select another icon.
I want to change my application to a tabbed format similar to the one below with Icons:
What type of View is being used below? Is this a FragmentActivity? Also, what is the best approach to go about conversion? I have a bunch of layouts with listviews in linear/relative layouts... Will I be able to reuse any existing code? I want also to be able to use the solution with Android 2.1 and up if possible.
Thanks!
In the image you provided, it looks to be a TabHost that is used (which can be within a normal Activity or a Fragment Activity) and will be available for Android 2.1 and beyond when using the Android Support library. Based upon your description, you most likely have an Activity per each of your items that you will probably want to convert into a different Fragment. This may take a little time, but a Fragment is very similar to a normal activity in many ways, so once you start getting used to it, converting over the old Activities should be a breeze.
If you plan on using these tabs and you follow the Android design UI guidelines, you may want to use the TabHost in conjunction with a ViewPager. There is a great tutorial for this online that also allows for backward compatibility (down to at least 2.1) found here: http://thepseudocoder.wordpress.com/2011/10/13/android-tabs-viewpager-swipe-able-tabs-ftw/
Support library for fragments/viewpager: http://developer.android.com/tools/extras/support-library.html
More info about a TabHost and using Tabs with fragments can be found here:
http://developer.android.com/reference/android/widget/TabHost.html
http://thepseudocoder.wordpress.com/2011/10/04/android-tabs-the-fragment-way/
You can use TabLayout and a TabActivity to achieve layout in picture. Bad news is these are deprecated as of Android 3.0. Google advises to use fragments instead of these.
I have a linear linear layout with 10 buttons in it. I need to drag these buttons and add it into another linear layout(Horizontal) in the order they are dropped. Please help me in doing this?
I have some suggestions on how to do drag-drop in apps running on API level 8 up and beyond. I studied the source code for the Android Launcher module and learned about the drag-drop framework they put in place for that. I have found that is a good foundation on which to build. I have written up the details of the key classes (DragSource, DropTarget, DragLayer, DragController) in a series of articles on my blog. A solution is too long to post here, so I refer you to those notes:
(a) Moving Views In Android - Part 2, Drag and Drop - this describes the basic framework and includes a demo app. Since I was primarily concerned with learning about drag-drop, I used the now deprecated AbsoluteLayout class. The follow-on to this one (Part 3) is worth looking at too because it develops further the notion of DropTarget.
(b) Drag-Drop for an Android GridView - a demo app that shows how to use the drag-drop framework for grid views. Even better, it illustrates how to get by without AbsoluteLayout. In this case, the DragLayer and other classes know more about the kind of layouts they are working with.
The demo apps illustrate images and text views being dragged. The underlying code is perfectly general: any view can be dragged. A problem you will face with dragging buttons is making sure that the start of a drag operation will not be confused with the normal click handling that buttons do. Consider using a long click to initiate a drag sequence.
I have an Android app that I would like to convert to an Android library. The app is based around one activity whose entire XML layout contains only a webview that covers the entire screen. The library UI (really, just the webview) must now be integrated into the layout of other apps. For example, one parent app has a tab structure. I would like to have the library webview displayed in one of the tabs, with the tabs always visible at the bottom of the screen. Ordinarily, I'd opt to set the app-library boundary at the activity level but that does not work in this case -- we cannot pop up a new Activity from the library because that would cover all of the screen and the tabs at the bottom.
What is the best way to convert this to a library so that it works within the tab structure of the parent app? Where should the app-library boundary be? Some of my ideas are:
Let the library user create an activity with the custom layout that he prefers (tabs in this case). Make sure that the layout contains a webview. Use findViewById to get the webview object and pass this object into the library for the library to use to display pages. Main disadvantage here is that parts of the library need to hook up some Broadcast receivers onto the parent activity (which is not really part of the library in this scenario), and this coupling seems rather dubious.
Perhaps use fragments which were introduced in Android 3.0. However, these mostly seem geared towards tablets. Would these work in this case?
Is there another option compatible with Android 2.1+ that I am not aware of?
I decided to go with Fragments, using the compatibility library.
http://developer.android.com/guide/topics/fundamentals/fragments.html
http://developer.android.com/sdk/compatibility-library.html
Fragments are really the best choice in this case because:
They have a life cycle similar to that of activities, making conversion easy.
They are a chunk of UI with related functionality, which is exactly what's needed in this case.