android-actionbaractivity

support.v7 ShareActionProvider crashes if showAsAction=“always”

女生的网名这么多〃 提交于 2021-02-07 20:24:04
问题 Trying to use ShareActionProvider from the support library (v7), my app works fine if I don't set the showAsAction attribute for the menu item. My intention is to display this menu item as an icon and not as an overflow item. If, however, I set it to show always, the app crashes with NullPointerException . 07-30 01:23:37.778: E/AndroidRuntime(25853): java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.ImageView.setImageDrawable(android.graphics.drawable

Android: Icons don't appear in Action Bar

这一生的挚爱 提交于 2020-01-13 17:57:21
问题 I'm following the google tutorial for action bars but the icons don't appear on it, this is the menu xml file: <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:yourapp="http://schemas.android.com/apk/res-auto" > <item android:id="@+id/action_refresh" android:icon="@drawable/ic_action_refresh" android:title="refresh" android:showAsAction="ifRoom"/> <item android:id="@+id/action_settings" android:icon="@drawable/ic_action_settings" android:title="settings" android

Android: Icons don't appear in Action Bar

和自甴很熟 提交于 2020-01-13 17:57:11
问题 I'm following the google tutorial for action bars but the icons don't appear on it, this is the menu xml file: <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:yourapp="http://schemas.android.com/apk/res-auto" > <item android:id="@+id/action_refresh" android:icon="@drawable/ic_action_refresh" android:title="refresh" android:showAsAction="ifRoom"/> <item android:id="@+id/action_settings" android:icon="@drawable/ic_action_settings" android:title="settings" android

v7-21 ActionBarActivity not showing the app main icon on the left

孤人 提交于 2020-01-01 18:23:59
问题 I implemented a basic activity as public class MainActivity extends Activity and when I add an actionbar with the menu as below, the app icon defined in the AndroidManifest.xml shows up nicely <application android:allowBackup="true" android:icon="@drawable/logo_green" android:label="@string/app_name" android:screenOrientation="portrait" android:theme="@style/Theme.AppCompat.Light.DarkActionBar" > When I try to change to android.support.v7.app.ActionBarActivity ( and switch to compatible

Android L ActionBarActivity using Feinstein SldingMenu and AppCompat v21 is cut off at bottom of the screen

我与影子孤独终老i 提交于 2020-01-01 12:09:06
问题 I'm using AppCompat v21 with the Style "NoActionBar" and add a Action/Toolbar in onCreate . Also a SlidingMenu of Feinstein is added and that causes the problem that the that the Activity (and therefore the inside Fragments) overlap with the navigation buttons of Android (it is not fully shown, cut off at the bottom) if i add: android:layout_marginBottom="48dp" in the layout it everything is visible (of course). On Android 4.4. everything is shown properly. What am I missing on Android L

Android:ActionBarActivity findViewById return NULL

江枫思渺然 提交于 2019-12-30 14:43:32
问题 I can't to get the button from fragment, what's wrong? Recieve a uncaught exception - nullpointerexception; Button can't be found. Early all will be find, but after update android sdk, all is changed (( package com.example.test; import java.io.IOException; import android.media.MediaPlayer; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v7.app.ActionBarActivity; import android.util.Log; import android.view.LayoutInflater; import android.view.Menu;

Showing dividers between menu items in android actionbar

倖福魔咒の 提交于 2019-12-25 03:24:13
问题 I want show dividers between menu items in android actionbar Icon1 | Icon2 | icon3 my code for showing menu items is <item android:id="@+id/menu_time" android:icon="@drawable/action_time_btn_stateful" android:title="time" peel:showAsAction="always"/> <item android:id="@+id/menu_room_change" android:icon="@drawable/action_room_btn_stateful" android:title="change" peel:showAsAction="always"/> <item android:id="@+id/menu_like_set" android:icon="@drawable/like_button" android:title="Like" peel

Android: Fragment's onOptionsItemSelected doesn't get called

不羁的心 提交于 2019-12-23 17:27:10
问题 I have an ActionBarActivity and one Fragment. The Activity has no menu inflated, while the Fragment has a menu with two buttons. Fragment menu is visible, but the buttons don't react at all when tapped. At debugging I can see that both onCreateOptionsMenu() for Fragment and Activity get called, but when tapping buttons no onOptionsItemSelected() gets called, neither from Activity nor from Fragment. Activity @Override public boolean onCreateOptionsMenu(Menu menu) { return super

How to recover from SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION?

六眼飞鱼酱① 提交于 2019-12-23 11:21:17
问题 This problem actually arose in a more complex situation involving orientation changes and varying layouts for portrait and landscape but in it's minimal version the problem is this: We would like to switch back and forth between a "normal" and "fullscreen" layout, i. e.: one layout where the content only takes up the space that's left inside of navigation bar and status bar one layout where the content takes up the whole screen and slides under both navigation and status bar To switch from

Back navigation with Fragments / Toolbar

家住魔仙堡 提交于 2019-12-22 05:25:11
问题 I'm scratching my head with this one now.... I have an ActionBarActivity that loads an initial Fragment - the original menu is inflated within the activity. Now, I have a navigation bar that, when an item is selected, loads a different fragment and adds this to the backstack. When I do this, there are a couple of things I want to set: Set the home as up indicator Invalidate the options menu from the main activity Set has options to true for the Fragment Ensure that the up indicator correctly