android-actionbar

Selecting Native Tabs while Espresso testing

╄→гoц情女王★ 提交于 2019-12-10 09:27:53
问题 I have a viewpager which utilizes the native actionbar Tabs as the indicator. I would like to navigate to different tabs, but Tab component is not a view therefore, onView, or withText does not work properly with perform clicks. Is there a specific way I can do to navigate through the Tab navigation? 回答1: You could use swiping to navigate between your tabs: onView(withId(R.id.viewpager)).perform(swipeLeft()); onView(withId(R.id.viewpager)).perform(swipeRight()); 回答2: Assuming there is text on

Setting the dropdown for the action bar item

跟風遠走 提交于 2019-12-10 07:14:52
问题 I am setting the action bar and item by the below code and the respective image1 is shown. When the user clicks on show bookmark screen action item, it goes to other activity. In that activity I want another item( SELECT BOOKMARK TYPE ) to be displayed in the place of SHOW BOOKMARK SCREEN . So I am thinking to managing it with abstract class by setting the respective things to true or false as shown below. But now I am unable to get two things. 1) How to differentiate in case 0 for both

Can't get the Android 4.0 Split Action Bar working

左心房为你撑大大i 提交于 2019-12-10 04:33:40
问题 I've followed the development pages on the android dev site, but I cannot get my action bar to split to the top and bottom of the screen. I've got a menu xml defined with a couple of options: <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@+id/stop_services" android:icon="@drawable/ic_launcher" android:title="@string/stop" android:showAsAction="ifRoom|withText"/> <item android:id="@+id/start_services" android:icon="

Custom image instead of logo in ActionBar/ActionBarSherlock

旧城冷巷雨未停 提交于 2019-12-10 04:09:59
问题 How can I change the default logo icon of an ActionBar to be a custom image? Similar as how it works on Whatsapp? 回答1: The ActionBar uses the android:logo attribute of your manifest, if one is provided. That lets you use separate drawable resources for the icon (Launcher) and the logo (ActionBar, among other things). So you should add this tag into manifest like .. <application android:logo="@drawable/custom_image" Update : You can use ActionBar.setLogo() for runtime. Two versions are there

Android: ShareActionProvider with no history

删除回忆录丶 提交于 2019-12-10 02:56:28
问题 According to the Android documentation if I don't want my ShareActionProvider to persist the share history I should call mShareActionProvider.setShareHistoryFileName(null) However when I do this I get the following crash on selecting a share option: 11-15 10:06:34.848: E/AndroidRuntime(22461): java.lang.IllegalStateException: No preceding call to #readHistoricalData 11-15 10:06:34.848: E/AndroidRuntime(22461): at android.widget.ActivityChooserModel.persistHistoricalDataIfNeeded

Android ActionBar Recreate Options Menu

家住魔仙堡 提交于 2019-12-10 01:56:49
问题 When using the ActionBar in Android, how do you refresh the options menu? I have tried hiding and showing the bar, along with getting a new instance of it with "getSupportActionBar()" I am trying to implement a Login/Logout button that will change dynamically based on the state of the user. Here is my onCreateOptionsMenu method @Override public boolean onCreateOptionsMenu(Menu menu) { if (loggedIn) menu.add(0, MENU2, 0, "Logout").setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); else menu.add

How to center ImageView in a toolbar?

狂风中的少年 提交于 2019-12-10 00:55:24
问题 Been trying to center a logo inside my toolbar. When i navigate to the next activity, the "up affordance" icon is present, and it will push my logo slightly to the right. How can I keep my logo at the center of the toolbar, without removing the up affordance icon? This is my toolbar tag <android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="wrap

Android: Fragment stack confusion with ActionBar and Tabs

大憨熊 提交于 2019-12-09 23:11:13
问题 I'm working on an App utilizing ActionBarSherlock with navigation tabs and multiple fragments. I have three navigation tabs each with one or more child views. I also have three option menu items with one or more child views. Everything works fine when I drill down the views within each Tab or option menu. Each initial subview is a ListFragment that calls a detail view or views. I run into problems when I start switching tabs while in the child views or the option menu fragment. My views start

Applying a theme to v7 Support Action Bar

三世轮回 提交于 2019-12-09 18:01:16
问题 I am using the support v7 library to implement ActionBar in my app..I have this in my styles.xml file <?xml version="1.0" encoding="utf-8"?> <resources xmlns:android="http://schemas.android.com/apk/res/android"> <style name="AppTheme" parent="@style/Theme.AppCompat.Light.DarkActionBar"> <item name="android:actionBarStyle">@style/ActionBarTheme</item> </style> <style name="ActionBarTheme" parent="android:Widget.ActionBar"> <item name="android:background">#FFFF0000</item> </style> </resources>

Change line color in tabs - ActionBarSherlock

北慕城南 提交于 2019-12-09 17:46:18
问题 I'm using ActionBarSherlock to make my app compatible with older devices. The implementation was easy, but now i need to style the default Holo blue line that you see under the tabs to a red line. I've been reading a few topics (topic 1, topic 2) here on SO and also the ABS doc (link), but i can't get it to work. This is what i have so far. In my AndroidManifest.xml i added this line to the application tag. <application android:icon="@drawable/ic_launcher" android:label="@string/app_name"