Android action bar items on the left side of the action bar - java

I am required to create an action bar that has its items split: four of them on the right side and four on the left (it's a tablet-only application). In portrait mode they shouldn't be split. Is it possible to implement without using a custom view for the left side of the action bar, as it seems inconsistent?
Note that I want to know how to do it with the default action items, not with the custom ones in a custom view, and that I don't have any influence on the UI decisions, so please do not suggest to change the concept.

All ActionBar items are aligned to the right. It is not possible without custom view.
But you can use actionViewStyle for buttons to make them styled as menu items.
https://stackoverflow.com/a/13143180/1366471

Related

Android Horizontal Scrolling that Snaps to List Items

I'd like to implement a UI experience in Android where a user can view a single item (for example, an item in my case is a collection of texts), and swipe left or right on the item to go to the previous or next item.
From my research, ListView does not implement horizontal scrolling. Potential candidates seem to be HorizontalScrollView and GridView, but I haven't seen any examples that can do this simply - only seemingly complicated libraries that need to be included.
My question is, is there a way to use ListView, HorizontalScrollView, GridView, or a combination of them to implement a horizontal scroll that shows one item at a time and snaps to the item being displayed?
The highlighted area in the picture below shows where I'm trying to implement this logic.
It looks like the best option to achieve this experience is a ViewPager, which requires the android support library.
http://developer.android.com/reference/android/support/v4/view/ViewPager.html

Is there a way to change the place where android menu appears

normally when the menu button is pressed , the menu appears from the center bottom of the screen. Is there a way to make it appear from sides.
On Android 3.0 and higher, items from the options menu are presented by the action bar which is standard way to provide access to menus and normally menus appears from top right corner. You should go through this once:
Menus Action Bar

Actionbar Custom Position

I'm relatively new with Android development, and I received a layout for an app where I have to put some kind of bar with images above the action bar.
I searched a lot in Google but I couldn't find anything about change the action bar position. I also found some info saying:
Google highly recommend to NOT change the action bar position(...)
Well, how I got some custom views for the action bar icons was to put the view below the action bar. However, what I am supposed to do is put the view above the action bar.
Is there a way to put a view above the action bar or change the action bar position?
Is there a way to put a view above the action bar or change the action bar position?
Not that I am aware of.

ActionBar and CustomView - home button

I want to have a CustomView on my ActionBar that will define buttons, logos, etc. But I also want to make use of the Home Button and the ability to search in the ActionBar via a Search Interface. Is it possible to add, i.e. Home Button with icon on an ActionBar with Custom view layout?
Thanks
It is certainly possible to use a custom view on the action bar. The Strava android app does just that (or at least gives the appearance of an action bar at the top that has a non-standard layout).
Addressing your requirements one at a time: You can inflate a view of your own and assign it to the action bar:
View customView= getLayoutInflater().inflate(R.layout.customView, null);
getSupportActionBar().setCustomView(customView);
What you put in your view is, naturally, entirely up to you but you will have to manage everything yourself, including the home button actions. This includes the icon and text for the home button on the left hand side and search functionality. On a small device (especially in portrait mode) I'd go for a search icon only but on devices with more real estate you could fit a text input field in as well, using the alternative layouts feature to automatically pick up the most appropriate view for the device.

Drop down menu from action bar - allowing drag and drop icons to be drawn to screen

as the title suggests I'm trying to add code to my app which allows the user to click on an item in the action bar menu which then unfolds a drop down menu (spinner class?) containing a few options such as lamp, tv etc. - each with an icon. The user will then be able to select one of these and drag and drop the icon (or an image representing the icon) to the canvas where it is then drawn. What is the best way to go about this?
If you're referring to the ActionBar overflow menu items, then you would have to take a look at the code for the ActionBar in the framework and extend it in your application, but that would firstly require quite a hassle and secondly would break compatibility when changes are made to the ActionBar in new versions of Android.
Also, this goes completely away from what the ActionBar is intended to be. You should only have actions in the overflow menu, not contain elements that directly interact with the Activity content. It's just wrong. Consider redesigning your UI so that you implement the requested featured inside the content view, not on the ActionBar.

Categories

Resources