Display ActionMode over Toolbar

Since you are using the Toolbar, I also assume you are using the AppCompatActivity and have replaced the built in ActionBar with your custom Toolbar using setSupportActionBar(toolbar); First of all ensure you are importing the correct namespace: import androidx.appcompat.view.ActionMode; // Or import android.support.v7.view.ActionMode; and NOT import android.view.ActionMode; then use _actionMode = startSupportActionMode(this); and NOT _actionMode … Read more

Android transparent status bar and actionbar

I’m developing an app that needs to look similar in all devices with >= API14 when it comes to actionbar and statusbar customization. I’ve finally found a solution and since it took a bit of my time I’ll share it to save some of yours. We start by using an appcompat-21 dependency. Transparent Actionbar: values/styles.xml: … Read more

Change Toolbar color in Appcompat 21

again this is all in the link you supplied to change the text to white all you have to do is change the theme. use this theme <android.support.v7.widget.Toolbar xmlns:android=”http://schemas.android.com/apk/res/android” xmlns:app=”http://schemas.android.com/apk/res-auto” android:id=”@+id/activity_my_toolbar” android:layout_width=”match_parent” android:layout_height=”wrap_content” android:minHeight=”?attr/actionBarSize” android:background=”?attr/colorPrimary” app:theme=”@style/ThemeOverlay.AppCompat.Dark.ActionBar” app:popupTheme=”@style/ThemeOverlay.AppCompat.Light”/>

Android Toolbar Adding Menu Items for different fragments

Add similar code to your fragments: @Override public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.library_fragment, parent, false); setHasOptionsMenu(true); return v; } @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.your_menu_xml, menu); super.onCreateOptionsMenu(menu, inflater); } This way you can customize the menu for your fragments.

How do I style appcompat-v7 Toolbar like Theme.AppCompat.Light.DarkActionBar?

The recommended way to style the Toolbar for a Light.DarkActionBar clone would be to use Theme.AppCompat.Light.DarkActionbar as parent/app theme and add the following attributes to the style to hide the default ActionBar: <style name=”AppTheme” parent=”Theme.AppCompat.Light.DarkActionBar”> <item name=”windowActionBar”>false</item> <item name=”windowNoTitle”>true</item> </style> Then use the following as your Toolbar: <android.support.design.widget.AppBarLayout android:layout_width=”match_parent” android:layout_height=”wrap_content” android:theme=”@style/ThemeOverlay.AppCompat.Dark.ActionBar”> <android.support.v7.widget.Toolbar android:id=”@+id/toolbar” android:layout_width=”match_parent” android:layout_height=”?attr/actionBarSize” … Read more

Cannot catch toolbar home button click event

If you want to know when home is clicked is an AppCompatActivity then you should try it like this: First tell Android you want to use your Toolbar as your ActionBar: setSupportActionBar(toolbar); Then set Home to be displayed via setDisplayShowHomeEnabled like this: getSupportActionBar().setDisplayShowHomeEnabled(true); Finally listen for click events on android.R.id.home like usual: @Override public boolean … Read more

Creating a Preference Screen with support (v21) Toolbar

Please find the GitHub Repo: Here A bit late to the party, but this is my solution that I am using as a work around continuing to use PreferenceActivity: settings_toolbar.xml : <?xml version=”1.0″ encoding=”utf-8″?> <android.support.v7.widget.Toolbar xmlns:android=”http://schemas.android.com/apk/res/android” xmlns:app=”http://schemas.android.com/apk/res-auto” android:id=”@+id/toolbar” app:theme=”@style/ThemeOverlay.AppCompat.Dark.ActionBar” android:layout_width=”match_parent” android:layout_height=”wrap_content” android:minHeight=”?attr/actionBarSize” app:navigationContentDescription=”@string/abc_action_bar_up_description” android:background=”?attr/colorPrimary” app:navigationIcon=”?attr/homeAsUpIndicator” app:title=”@string/action_settings” /> SettingsActivity.java : public class SettingsActivity extends PreferenceActivity { … Read more

Creating a button in Android Toolbar

ToolBar with Button Tutorial 1 – Add library compatibility inside build.gradle dependencies { compile fileTree(dir: ‘libs’, include: [‘*.jar’]) compile ‘com.android.support:appcompat-v7:21.0.3’ } 2 – Create a file name color.xml to define the Toolbar colors <?xml version=”1.0″ encoding=”utf-8″?> <resources> <color name=”ColorPrimary”>#FF5722</color> <color name=”ColorPrimaryDark”>#E64A19</color> </resources> 3 – Modify your style.xml file <resources> <!– Base application theme. –> <style … Read more

How to get Toolbar from fragment?

You need to cast your activity from getActivity() to AppCompatActivity first. Here’s an example: ((AppCompatActivity) getActivity()).getSupportActionBar().setTitle(); The reason you have to cast it is because getActivity() returns a FragmentActivity and you need an AppCompatActivity In Kotlin: (activity as AppCompatActivity).supportActionBar?.title = “My Title”

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)