android-actionbar

Contextual Action Mode custom behavior

南笙酒味 提交于 2020-01-03 09:47:51
问题 In android developer's menu guide it is mentioned that: The action mode is disabled and the contextual action bar disappears when the user deselects all items, presses the BACK button, or selects the Done action on the left side of the bar. Technically, it means that mActionMode.finish() , the BACK button press, or the Done action selection call ActionMode.Callback onDestroyActionMode() method. My question is how to perform a custom action (for example Toast("Action mode exit by Done select")

Android - Change Actionbar Title Text Color

十年热恋 提交于 2020-01-03 06:48:08
问题 I'm developing an app and I want to change the textcolor of the actionbar title . now, I defined a theme in my manifest: <application android:theme="@style/AppTheme"> </application> which is defined in styles.xml: <style name="AppTheme" parent="android:style/Theme.Holo.Light"> <item name="android:textViewStyle">@style/AppTheme.TextView</item> <item name="android:actionBarStyle">@style/AppTheme.ActionBarStyle</item> </style> <style name="AppTheme.ActionBarStyle" parent="@android:style/Widget

popupBackground glitches with Material Design

◇◆丶佛笑我妖孽 提交于 2020-01-03 06:44:13
问题 I have been working on updating my apps to Material Design. I have an app that uses tabs. For some reason whenever I use android:popupBackground to set the drop down menu color it freaks out. I set up a default project with tabs and used the following theme and the same thing happened. Has anyone one else had this problem? My app is open source and so all the code is available here GitHub <?xml version="1.0" encoding="utf-8"?> <resources> <style name="AppTheme" parent="Theme.AppCompat.Light

How to add a listener for the up button in ActionBar on Android?

让人想犯罪 __ 提交于 2020-01-03 05:24:11
问题 I added the up button in the action bar of my android activity in this way: Activity: getSupportActionBar().setDisplayHomeAsUpEnabled(true); Manifest: android:parentActivityName=".MenuActivity"> It work fine but now i want to add a transition effect between activities. This transition work well: Intent intent = new Intent(getApplicationContext(), MenuActivity.class); startActivity(intent); overridePendingTransition(R.anim.slide_in_left, R.anim.slide_out_right); But where i should put this

Center positioning possible on actionbar?

佐手、 提交于 2020-01-03 05:01:14
问题 Is it possible to center anything in the actionbar? I know that the appIcon, appLogo, or the label can be set in the manifest, but it automatically jumps to the left side. Is there anyway to take the logo or title and position it to the center? I've found some discussions about this on Google, but mostly mentioning Adobe Flex 回答1: Figured out that you can have a custom layout in the actionbar. Create a custom layout (Just center an image or text in xml) and then call it in the actionbar. 回答2:

How to change the overflow button when in CAB?

谁说我不能喝 提交于 2020-01-03 04:18:07
问题 I have 2 different backgrounds to the Action bar. One light and another dark. One for the default title and another for the CAB (when some of the elements are selected/activated). I would like to have 2 different overflow when in those different states. I tried the selector but couldn't find the state to represent when in CAB mode. Any idea how to provide different overflow buttons? On a more general note, where can I start exploring the Action Bar so I could find the answers myself instead

Detecting action bar icon long press

只愿长相守 提交于 2020-01-03 03:18:10
问题 I want to detect long press on application's icon in the ActionBar in Android application. Is it possible? 回答1: Add custom view to action bar View view = getLayoutInflater().inflate(R.layout.actionbar,null); btnClose = (ImageView) view.findViewById(R.id.btnClose); btnClose.setOnLongClickListener(new OnLongClickListener() { @Override public boolean onLongClick(View v) { Log.d("rvg", "Long click:"); return false; } }); getSupportActionBar() . setCustomView(view); 回答2: Unfortunately standard

ActionBar Up button: go to previous Activity with prev fragment

≯℡__Kan透↙ 提交于 2020-01-03 02:49:16
问题 I need your help regarding my application flow. MainActivity (with Navigation Drawer) -- Fragment A -- Fragment B -- Fragment C (articles list view) ArticleActivity -- Fragment D (article detail view) Fragment C ( MainActivity ) displays a list of items ( ListView ). Selecting an item leads to fragment D (handle by ArticleActivity ) which presents that item in more detail. Fragment D displays a "Up" button that should allow the user to returns to previous screen (the detail view). The problem

Android - ResourcesNotFoundException when trying to set Action Bar icon by resource id

拥有回忆 提交于 2020-01-03 02:27:09
问题 I am changing my Action Bar icon to CircleImageView that shows profile picture: CircleImageView actionBarIcon_Profile = new CircleImageView(this); actionBarIcon_Profile.setImageDrawable(getResources().getDrawable(R.drawable.my_picture)); actionBarIcon_Profile.setLayoutParams(new LayoutParams(48, 48)); actionBarIcon_Profile.setId(R.id.actionBarIcon_Profile); getActionBar().setIcon(R.id.actionBarIcon_Profile); The ids are kept in ids.xml: <?xml version="1.0" encoding="utf-8"?> <resources> <item

How to keep actionbar fixed across all activities?

£可爱£侵袭症+ 提交于 2020-01-02 18:37:22
问题 In the Facebook app v2.3, when you navigate from one activity(or frgament?) to another, the actionbar stays fixed across all activities(or fragments?). For example, If you navigate from you news feed to someone's profile page, then the action bar stays constant, and the page below is refreshed. So my question is, is it possible to have this behavior using only activities? Or should i just have one main activity, and fragments for all sub activities? 回答1: One activity and as many fragments as