android-actionbar

How to set my toolbar fixed while scrolling android

好久不见. 提交于 2019-12-23 17:18:45
问题 I am currently working in e-commerce android app, i need to fix the toolbar while scrolling. As i attached the screenshot below. while scrolling the action bar need to be fixed and the body content scroll behind the toolbar Here is the layout xml: <LinearLayout android:id="@+id/container_toolbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <include android:id="@+id/toolbar_reg" layout="@layout/app_bar" /> </LinearLayout> <ScrollView

Android disable overlay of ActionBar and NavigationBar for FLAG_TRANSLUCENT

跟風遠走 提交于 2019-12-23 17:09:01
问题 As you can see by the picture the navigationbar and the statusbar is overlaying the layout. All I have done is if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { Window w = getWindow(); w.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION, WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION); w.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); w.setFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN

Custom rows for menu items in action bar

女生的网名这么多〃 提交于 2019-12-23 16:15:29
问题 I am trying to create kind of list view with custom rows in menu in action bar. something like this: I have searched a lot on web but could not find anything useful. How can I achieve this thing? I know you can bind custom views with items in menu but how? I want to bind list view with this item: <item android:id="@+id/action_settings" android:orderInCategory="100" android:showAsAction="never" android:title="@string/action_settings"/> 回答1: I had figured out after a while. If you want to list

Item title not displayed in portrait with SHOW_AS_ACTION_WITH_TEXT

浪尽此生 提交于 2019-12-23 15:34:46
问题 In my activity, I have an action mode with a single item which has a title and an icon. I want both the title and the icon to be displayed, so I use SHOW_AS_ACTION_WITH_TEXT and SHOW_AS_ACTION_ALWAYS flags. In landscape orientation, it's fine. I have title + icon. But in portrait orientation only the icon is displayed (though there's a lot of free space). Does anyone know what I could do to fix it ? Note that the title is correctly displayed if I remove the icon. Here is my sample code:

Android Actionbar Left Menu

廉价感情. 提交于 2019-12-23 12:53:08
问题 I am working on android application. I have to add a menu on the left side of Action Bar. I am able to add menu on the right side but along with right side menu, I also want to add a menu on left side of Action Bar just like : I have spent hours on searching how to achieve that left side menu, but no success. How can I achieve that? Thanks! 回答1: This is called Navigation Drawer , You can look at the official android tutorial here, and this one too 回答2: You cant align menu to left .you should

How can I keep the action/title bar but hide the notification bar

∥☆過路亽.° 提交于 2019-12-23 12:46:37
问题 How can I keep the action/title bar but hide the notification bar? This question looks like it has already been answered but most of the answers I found hide both the action bar and the notification bar. I want to be able to keep the action/title bar. The best I've gotten is hiding both and using a linear layout to display a custom action/title bar but I want a system generated one. Also is it possible to hide just the action bar whilst displaying the notification bar? 回答1: To hide the

set numeric input type to SearchView in ActionBar

﹥>﹥吖頭↗ 提交于 2019-12-23 12:33:25
问题 I don't manage to set the numeric input type to the SearchView in my ActionBar. I have the following searchable.xml file in my res/xml folder: <searchable xmlns:android="http://schemas.android.com/apk/res/android" android:inputType="number" android:label="@string/app_name" android:hint="@string/search_hint"> </searchable> And I set the searchable configuration to the SearchView as follows: // Get the SearchView and set the searchable configuration SearchManager searchManager = (SearchManager)

Changing actionBar dropdown background color

僤鯓⒐⒋嵵緔 提交于 2019-12-23 12:01:07
问题 How do i change the color of the background where it says "add contact" and "about". Now its kind of grayish, but i want it to be white! This is a actionBar with dropdown, not a spinner. And im not using that actionbarsherlock thing. 回答1: For example, in you exisiting parent Style definition, add just the android:popupMenuStyle attribute as shown below: <style name="Theme.Example" parent="@android:style/Theme.Holo.Light"> <item name="android:popupMenuStyle">@style/PopupMenu.Example</item> ...

Android support action bar not showing overflow menu

六眼飞鱼酱① 提交于 2019-12-23 10:08:24
问题 My android app supports 2.2 and higher. I'm using the appcompat support library for the action bar, so it should only show if there are things that don't fit. I want my action bar to support the overflow button (the three vertical squares) that reveals a menu with the other items when clicked. In my menu file, I have three items set up. However on the app I only see two of them, and the overflow button is not showing as well. activity_menu.xml <menu xmlns:android="http://schemas.android.com

How to Show/Hide Action Bar item programmatically via Click Event

佐手、 提交于 2019-12-23 09:44:32
问题 By default I set the visibility to false by using following code. @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_items, menu); menu.findItem(R.id.action_share).setVisible(false); return true; } Now how can I make it visible again when user clicks a button in my activity. 回答1: In your onCreateOptionsMenu: public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu;