android-actionbar

Animation for action bar show action

為{幸葍}努か 提交于 2021-02-19 05:09:22
问题 I'm using android 4.2 with appCompat of the latest version. I've implemented showing and hiding my action bar with these methods: final ActionBar actionBar = getSupportActionBar(); actionBar.hide(); actionBar.show(); When action bar is being hide, it does so with smooth animation gradually sliding up. However, when I show it it appears on the screen almost instantly, almost without smooth animation sliding down. Is there any way I can configure it to show smoothly as it happens with hiding it

What's the proper way to setup an Android PreferenceFragment?

你离开我真会死。 提交于 2021-02-18 21:58:24
问题 I'm trying to implement a basic settings activity in an Android app and either get a blank white screen or a crash. The documentation and samples I've seen aren't helping because they're either old or inconsistent. For example, depending on where you look, the settings activity should either extend Activity, PreferenceActivity, or AppCompatPreferenceActivity (part of the File>New>Activity>Settings Activity). developer.android.com says you should implement the following: public class

ActionBar Back button opens drawer instead of going back

拈花ヽ惹草 提交于 2021-02-11 12:20:51
问题 In my app I have problem like this. Note that I'm working with fragments and I have drawer too. That's the method in my MainActivity for drawer open/close. public void drawerInit() { toolbar = (Toolbar) findViewById(R.id.toolbar_actionbar); setSupportActionBar(toolbar); drawer = (DrawerLayout) findViewById(R.id.drawer); view = findViewById(R.id.mainView); toggle = new ActionBarDrawerToggle( this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close) { @Override

Android ActionBar vs ToolBar

百般思念 提交于 2021-02-11 00:51:01
问题 Can you make Android new Toolbar to be shown with shadow like you could do with the old ActionBar? Please refer to the image: Left is ActionBar and you can see it looks "floating" with shadow while the right one is ToolBar, how can you show it the same? 回答1: Use attibute android:elevetion=4dp on toolbar. 来源: https://stackoverflow.com/questions/29829746/android-actionbar-vs-toolbar

Android ActionBar vs ToolBar

戏子无情 提交于 2021-02-11 00:49:12
问题 Can you make Android new Toolbar to be shown with shadow like you could do with the old ActionBar? Please refer to the image: Left is ActionBar and you can see it looks "floating" with shadow while the right one is ToolBar, how can you show it the same? 回答1: Use attibute android:elevetion=4dp on toolbar. 来源: https://stackoverflow.com/questions/29829746/android-actionbar-vs-toolbar

How to increase the menuitem width in android while using Actionbar

核能气质少年 提交于 2021-02-07 21:37:18
问题 I have a problem to increase the width of MenuItem in Action bar, it take the fixed width. Below is screen shot, and want to achieve the below one, Below is the code: search_layout.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:background="@drawable/search_view_background" android:layout_width="match_parent" android:layout_marginTop="10dp" android:layout_marginBottom="10dp" android

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: ActionBar glitch on show and hide

拜拜、爱过 提交于 2021-02-07 08:13:36
问题 I would like to show/hide the action bar upon a click. It does show and hide but it is not smooth...the bottom part hides but a different background for a little while before disappearing. I even tried it in a simple hello world app and the result is the same. Here's the code: public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); TextView tv = (TextView) findViewById(R.id.shit); tv.setOnClickListener(new OnClickListener()

Android: ActionBar glitch on show and hide

删除回忆录丶 提交于 2021-02-07 08:02:19
问题 I would like to show/hide the action bar upon a click. It does show and hide but it is not smooth...the bottom part hides but a different background for a little while before disappearing. I even tried it in a simple hello world app and the result is the same. Here's the code: public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); TextView tv = (TextView) findViewById(R.id.shit); tv.setOnClickListener(new OnClickListener()

Is setSupportActionbar required anymore?

眉间皱痕 提交于 2021-02-04 05:52:27
问题 With the new Toolbar widget introduced and it's AppCompat (android.support.v7.widget.Toolbar) version available, is it required to call setSupportActionbar(toolbar) anymore? Or is there any advantage of calling setSupportActionbar; as now we can set title, sub-title, navigation-icon, navigation-icon-click-listener ( getSupportActionBar().setDisplayHomeAsUpEnabled(true) replacement ), menu, menu-click-listener ( options-menu replacement ) etc directly on the toolbar without ever calling