Android how to get AppCompat.Translucent type theme with support actionbar?

You can create a new set of styles to use which have the same properties as Theme.Translucent from themes.xml. Add the following to your styles.xml file: <style name=”Theme.AppCompat.Translucent”> <item name=”android:windowNoTitle”>true</item> <item name=”android:windowBackground”>@android:color/transparent</item> <item name=”android:colorBackgroundCacheHint”>@null</item> <item name=”android:windowIsTranslucent”>true</item> <item name=”android:windowAnimationStyle”>@android:style/Animation</item> </style> You can change the prefix Theme.AppCompat to something else if you want to inherit other things … Read more

Use Tab with new ToolBar (AppCompat v7-21)

With the API 21 the method setNavigationMode(ActionBar.NAVIGATION_MODE_TABS) is deprecated. UPDATE 01/08/2019 (Material Components Library) Add the dependency to your build.gradle: dependencies { implementation ‘com.google.android.material:material:1.1.0’ } Then you can use the new TabLayout. <androidx.constraintlayout.widget.ConstraintLayout> <com.google.android.material.appbar.AppBarLayout …> <androidx.appcompat.widget.Toolbar …/> <com.google.android.material.tabs.TabLayout … /> </com.google.android.material.appbar.AppBarLayout> <androidx.viewpager.widget.ViewPager android:id=”@+id/viewpager” app:layout_behavior=”@string/appbar_scrolling_view_behavior” /> </androidx.constraintlayout.widget.ConstraintLayout> The code is simple: TabLayout tabs = (TabLayout) findViewById(R.id.tabs); … Read more

Toolbar navigation icon never set

Currently you can use it, changing the order: (it seems to be a bug) Toolbar toolbar = (Toolbar) findViewById(R.id.my_awesome_toolbar); setSupportActionBar(toolbar); toolbar.setNavigationIcon(R.drawable.ic_good); toolbar.setTitle(“Title”); toolbar.setSubtitle(“Sub”); toolbar.setLogo(R.drawable.ic_launcher);

How to make a ActionBar like Google Play that fades in when scrolling

The following is the code I used in the app I am working You will have to use the OnScrollChanged function in your ScrollView. ActionBar doesn’t let you set the opacity , so set a background drawable on the actionbar and you can change its opacity based on the amount of scroll in the scrollview. … 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”/>

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

Android 4.3 menu item showAsAction=”always” ignored

Probably you are missing required namespace: <menu xmlns:android=”http://schemas.android.com/apk/res/android” xmlns:[yourapp]=”http://schemas.android.com/apk/res-auto”> <item android:id=”@+id/menu_add_size” android:title=”@string/menu_add_item” android:orderInCategory=”10″ [yourapp]:showAsAction=”always” android:icon=”@android:drawable/ic_menu_add” /> </menu> Replace [yourapp] with your app name or any namespace your heart desires everywhere. Other things worth checking: See if your activity class extends ActionBarActivity Check if the issue persists. Android reference documentation: Adding Action Buttons. Here is the … Read more

getSupportActionBar from inside of Fragment ActionBarCompat

After Fragment.onActivityCreated(…) you’ll have a valid activity accessible through getActivity(). You’ll need to cast it to an ActionBarActivity then make the call to getSupportActionBar(). ((AppCompatActivity)getActivity()).getSupportActionBar().setSubtitle(R.string.subtitle); You do need the cast. It’s not poor design, it’s backwards compatibility.

MenuItemCompat.getActionView always returns null

Finally I found the solution. Changing namespace of actionViewClass from android:actionViewClass to app:actionViewClass Implementing android.support.v7.widget.SearchView.OnQueryTextListener interface for current activity. Directly use setOnQueryTextListener instead of SearchViewCompat.setOnQueryTextListener @Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.menu, menu); MenuItem searchItem = menu.findItem(R.id.action_search); SearchView searchView = (SearchView) MenuItemCompat.getActionView(searchItem); if (searchView != null) { searchView.setOnQueryTextListener(this); } return super.onCreateOptionsMenu(menu); … Read more

Difference between android-support-v7-appcompat and android-support-v4

UPDATE There are many changes done into support library since this question was answered. Good thing is, it is very well documented also. So you must read Support Library Documentation for more details and more available support library. Starting with Support Library release 26.0.0 (July 2017), the minimum supported API level across most support libraries … Read more

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