android-menu

How to add a popup menu with a customLayout with pointer arrow and anchor it to a view

限于喜欢 提交于 2019-12-24 20:44:36
问题 I want to make a popup menu with an arrow. I saw there are many tooltip libraries similar to this which have a similar layout but support only text. There is this library but that is very old and has depricated code. There are two other libraries but they have horizontal menus with jagged edges with no text. I am trying to add a customview to the popup menu anchored to a view with an arrow pointing towards the view something like this. https://ibb.co/ftjnjCd Alternatively I inflated a layout

Android, reusable toolbar for navigation - where to put code?

て烟熏妆下的殇ゞ 提交于 2019-12-24 12:46:36
问题 I want to implement a toolbar for navigation which appears at the bottom of almost all activities in my app. It will have a fixed amout of elements (four). Screenshot: (certain activities will still have their own toolbar at the top): In order to make it somewhat reusable, I've created a separate layout file for the toolbar which allows me to include it on multiple activities with: <include android:id="@+id/toolbar_main" layout="@layout/toolbar_main" /> Every item of the toolbar leads to

Dropdown menu items with custom views Android showAsAction never

大城市里の小女人 提交于 2019-12-24 11:28:12
问题 I am looking for the right way to implement dropdown menu with custom menu items. Default menu provided by Action Bar or Toolbar suits great, I also need "three dots" in the right top corner of the screen. But the problem is that I can specify custom layout for menu item only if it is visible directly on action bar. But in my case I need custom views for dropdown items, for example one item is divide other items has also different views that can be specified for each item, not for all (like

Android bottom bar menu onclick actions

泄露秘密 提交于 2019-12-24 10:59:34
问题 I want to have a common bottom menu bar through out the applications with every page. I have designed the bottom bar but i am confused with onClick event of the menu icons. whether i have to write the code for onClick listener with every activity class to make bar visible and working in every page or if there is any other way i can create a common bottom bar that lies with every page without writing the code of menu in every activity class. I tried to create through a creating a base class

Android: Open menu programmatically

夙愿已清 提交于 2019-12-24 08:24:14
问题 I've been trying to add a functionality to my android application such that when I click a button, menu listing should be visible: Here is my code: menu.xml: <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" tools:context="com.example.MainActivity" > <item android:id="@+id/action_onthego_sentence" android:title="settings" android:orderInCategory="100" app:showAsAction="never" /> <

Unable to set picture as. “No appps can perform this action”

假装没事ソ 提交于 2019-12-24 01:06:58
问题 I am trying to give users an option to set image as wallpaper/whatsapp dp like this. But I'm stuck with this code Uri sendUri = Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.a_day_without_thinking_mobile); Intent intent = new Intent(Intent.ACTION_ATTACH_DATA); intent.setDataAndType(sendUri, "image/jpg"); intent.putExtra("mimeType", "image/jpg"); startActivity(Intent.createChooser(intent,"Set As")); It shows a dialog that no apps can perform this action. I also tried to

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

Android: Options Menu exception in Android 3+ / Resources$NotFoundException: Resource ID #0x1090044

与世无争的帅哥 提交于 2019-12-23 15:51:30
问题 My app has a few activities, all have an options menu, which is the same. It works fine, only on one activity (a ListView subclass), it crashes when clicking the menu button. This only happens in 4.x (maybe 3.x - can't check), but not 2.3 or prior. Tested in the emulator and on different devices. Interesting fact: When I rotate the device after the activity has rendered and press the menu button then, it works fine. Also, the menu works while the list adapter still loads and the list is empty

Custom options menu for every fragment

自古美人都是妖i 提交于 2019-12-23 11:46:13
问题 i have a problem. I am trying to change the default option menu, different for every fragment. I created an xml file for every fragment and i putted them inside res/menu folder. Now i don't know how to tell android to change the default options menu in every fragment. I putted the fragment inside a pager view. The menu i am talking about is the one on the bottom near the home and back buttons. this is one of the custom menu <menu xmlns:android="http://schemas.android.com/apk/res/android"

Spinner as MenuItem not initialized by findViewById

▼魔方 西西 提交于 2019-12-22 10:32:54
问题 I have a spinner on my actionbar. It is a menuitem (not a navigation mode). It gives me back a nullpointerexception on the lines where i call a method from spinnerNumber. I think i'm doing something wrong with the xml or maybe i shouldn't initialize it on OnCreateOptionMenu (but i think that calling it on OnCreate, when the menu xml isn't still inflated, is not correct either). act_main.xml: <menu xmlns:android="http://schemas.android.com/apk/res/android" > <item android:id="@+id