android-actionbar

How to keep actionbar fixed across all activities?

白昼怎懂夜的黑 提交于 2020-01-02 18:37:09
问题 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

Programmatically change menu icon color in Toolbar

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-02 15:29:43
问题 I've developed an App, where the user can change the theme. I have a navigation view, with a menu icon in Toolbar that is black. I would like to change that icon, to have it white (on a black theme). I tried this code but it remained black: myToolbar.setTitleTextColor(Color.WHITE); ab.setHomeAsUpIndicator(R.mipmap.ic_menu_white_24dp); //ab=ActionBar ab.setDisplayHomeAsUpEnabled(true); The title becomes White, but the icon doesn't change. 回答1: 1.Add a completely new icon with your favorite

How to have android action bar back button return to fragment

天涯浪子 提交于 2020-01-02 12:16:06
问题 Hello all I have implemented a back button in the action bar in my app but I dont know how to return from an activity to a fragment or a fragment to fragment. so if someone could show me how to return from an activity to a fragment or even a fragment to another fragment that would be amazing. Here is the code i have right now public class Article extends Activity{ private WebView webview; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);

How can I allow horizontal tab navigation (swipe views) with action bar navigation tabs?

烂漫一生 提交于 2020-01-02 09:57:48
问题 How can I allow horizontal tab navigation (swipe views) if I'm using action bar navigation tabs? Is there anything special I have to do to get this to work with ActionBarSherlock? 回答1: The code-generated stuff for a "Tabs+Swipe" activity (from BlankActivity in the new activity wizard in Eclipse) has code for this. Basically, your tabs tie into a ViewPager , calling setCurrentItem() to change the page, rather than running their own FragmentTransaction or otherwise affecting the UI. The

List navigation (spinner) on the right side

二次信任 提交于 2020-01-02 09:27:12
问题 I have tried so many tutorials, but I could not find article that would tell me how to create spinner in action bar (sherlock version), but on the right side. Is there a way to do it? Do I need to create additional views and adapters? I just want to know easy way to create that spinner on the right side, nothing else, just it. 回答1: You'll need to create a custom layout for the view containing the spinner. Inflate and place it on the action bar and you're good to go. Here you have some sample

Android ActionBar turns black when loading Fragment with Google Map for the first time

送分小仙女□ 提交于 2020-01-02 08:08:15
问题 I have Activity where I made DrawerLayout where I have 5 entries in side menu and each menu entry is loading its fragment (below in code you will see only 3 Fragments, that's because last two menu entries are dummy for now). On that Activity I set my custom ActionBar. Activity and its onCreate method look something like this: public class ActivityOffline extends ActionBarActivity implements OnPreferencesFragmentListener { final String[] fragments = { array with fragments path }; private

Is it possible to use TransitionDrawable on the ActionBar?

*爱你&永不变心* 提交于 2020-01-02 07:28:08
问题 I'm trying to do some color animation on the action bar by using a TransitionDrawable. The code I'm trying is pretty simple, during onCreate, I put the transition drawable as the actionbar background: Drawable d = getResources().getDrawable(R.drawable.actionbar); actionbarDrawable = new TransitionDrawable(new Drawable[] { d, d }); getActionBar().setBackgroundDrawable(actionbarDrawable); then on the event I replace the second drawable of the TransitionDrawable and ask to animate it.

Navigation Drawer and with Activity in Android

▼魔方 西西 提交于 2020-01-02 07:04:42
问题 I am trying out the navigation drawer (slide menu) given in this tutorial. The difference with above link and mine is that instead of calling fragments I am trying to call the activity. When the app opens I am not able to see the Navigation drawer menu I can see only the action bar with HOME activity opened. Here is the code that I changed: (Is it necessary to have a fragment or can I use activity for my first screen in Navigation Drawer?) mTitle = mDrawerTitle = getTitle(); navMenuTitles =

How do I get action buttons with custom layouts to be styled like standard action buttons in Android 3.0+

半腔热情 提交于 2020-01-02 05:37:26
问题 I'm having a bit of trouble with custom action buttons in the honeycomb+ action bar. I'm adding a menu item that uses a custom layout (using the android:actionLayout attribute). The reason for the custom layout is that I want a button that has two lines of text that can be updated dynamically. However, I still want this action button to operate like the other standard buttons. By this I mean that the background fades in when the button is selected, and fades out again if it is unselected, all

Hide or remove Action Bar on specific Activity | Android

对着背影说爱祢 提交于 2020-01-02 02:11:05
问题 How I can remove Action Bar on specific activity not for all application, for example I have Sign Up activity and for this activity I want to remove Action Bar 回答1: In your AndroidManifest.xml use NoActionBar theme for your Activity like this: <activity android:name=".SignUpActivity" android:theme="@style/AppTheme.NoActionBar"/> and in your styles.xml <style name="AppTheme.NoActionBar"> <item name="windowActionBar">false</item> <item name="windowNoTitle">true</item> </style> 回答2: from within