android-actionbar

Hide action bar, but show when pulled down

£可爱£侵袭症+ 提交于 2019-12-24 18:43:39
问题 I have an action bar set up and it works great. I'd like to have it so that it is hidden until the user does something like pull down from the top of the screen, and then show it. I can't find any resources which discuss doing this. 回答1: You can also use Collapsing Toolbar <android.support.design.widget.AppBarLayout android:layout_width="match_parent" android:layout_height="180dp" android:theme="@style/ThemeOverlay.AppCompat.Dark"> <android.support.design.widget.CollapsingToolbarLayout

Center align ActionBar title & use custom font as well

大憨熊 提交于 2019-12-24 18:17:15
问题 Absolute Android development beginner here, so please bear with me. I am trying to achieve 2 things with my title in the ActionBar: Center align the title text Use a custom font for the title text I'm trying to follow this answer, so please look at that answer first. Contents of MainActivity.java // ATTEMPT TO STYLE THE ACTIONBAR this.getActionBar().setDisplayShowCustomEnabled(true); this.getActionBar().setDisplayShowTitleEnabled(false); LayoutInflater inflator = (LayoutInflater)this

cannot find symbol method getSupportActionBar()

二次信任 提交于 2019-12-24 14:37:58
问题 I know this question has been posted plenty of times, but I still unable to solve even i have tried many solution from Stack Overflow . import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentTransaction; import android.support.v7.app.ActionBar; import android.support.v7.app.ActionBarActivity; import com.example.project.myapplication.API.InfoAPI; import com.example.project.myapplication.Adapter

Make an Android ActionBar's ActionView's Width match the ActionBar's width

我怕爱的太早我们不能终老 提交于 2019-12-24 14:35:02
问题 I want to show an AutoCompleteTextView that is always expanded in my ActionBar . This is my menu xml: <menu xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@+id/visibility_menu_search" android:icon="@drawable/ic_action_search" android:showAsAction="always" android:actionLayout="@layout/visibility_search" /> </menu> This is my layout/visibility_search.xml <AutoCompleteTextView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match

How to hide navigation bar when i press action bar menu in Android

邮差的信 提交于 2019-12-24 13:42:46
问题 I hide the navigation bar (see below) but when I press the menu button on action bar the navigation bar immediately appear. Can I hide nav. bar permanently? @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); getWindow().getDecorView().setSystemUiVisibility( View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION |

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

Action Bar dropdown open and closed item styles

大城市里の小女人 提交于 2019-12-24 12:33:20
问题 I'm trying to style the action bar list navigation such that it has white text in the closed state. When I've done that, though, it has turned all the text white, which doesn't work with the white dropdown. Is there a way to style each individually? The docs are non-existant :( 回答1: Add Custom Layout for your Adapter . in this i have created one layout inside that i have add one TextView . with text color and background color . and set atapter like: ArrayAdapter<String> adapter = new

Text selection tools in ActionBar are white on white background after selecting text in Dialog

半世苍凉 提交于 2019-12-24 11:37:14
问题 Anyone had this issue, that after selecting text in dialog's EditText, toolbar appears with invisible action buttons (white on white background)? How do I set theme to a DialogFragment? 回答1: You can custom dialog theme in styles.xml: <style name="MyDialogTheme" parent="android:Theme.Holo.Dialog" /> then use MyDialogTheme in your DialogFragment UPDATE In your dialog use following codes to set custom theme: ContextThemeWrapper context = new ContextThemeWrapper(getActivity(), R.style

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

How to do a custom app bar from large title to small with animation?

南楼画角 提交于 2019-12-24 10:49:06
问题 I means this: The transition occurs as the content on the layer begin to scroll. It's similarly to prominent from material.io. But I don't know how to do it. I could not find an example. 回答1: Introduce This is implemented by View : Toolbar and CollapsingToolbarLayout inside AppBarLayout . Solution New project -> Choose Scrolling Activity -> Next -> Finish You will see similar activity_main.xml <com.google.android.material.appbar.AppBarLayout android:id="@+id/app_bar" android:layout_width=