How to change Toolbar home icon color

I solved it by editing styles.xml: <style name=”ToolbarColoredBackArrow” parent=”AppTheme”> <item name=”android:textColorSecondary”>INSERT_COLOR_HERE</item> </style> …then referencing the style in the Toolbar definition in the activity: <LinearLayout android:id=”@+id/main_parent_view” android:layout_width=”match_parent” android:layout_height=”match_parent” android:orientation=”vertical”> <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/ToolbarColoredBackArrow” app:popupTheme=”@style/AppTheme” android:layout_width=”match_parent” android:layout_height=”wrap_content” android:minHeight=”?attr/actionBarSize” android:background=”?attr/colorPrimary”/>

ViewPager in a NestedScrollView

I meet this problem ,i solve it by setFillViewport (true) <android.support.v4.widget.NestedScrollView xmlns:android=”http://schemas.android.com/apk/res/android” xmlns:app=”http://schemas.android.com/apk/res-auto” xmlns:tools=”http://schemas.android.com/tools” android:layout_width=”match_parent” android:id=”@+id/nest_scrollview” android:layout_height=”match_parent” app:layout_behavior=”@string/appbar_scrolling_view_behavior” tools:context=”mio.kon.yyb.nestedscrollviewbug.ScrollingActivity” tools:showIn=”@layout/activity_scrolling”> <android.support.v4.view.ViewPager android:id=”@+id/viewpager” android:layout_width=”match_parent” android:layout_height=”match_parent”/> in activity NestedScrollView scrollView = (NestedScrollView) findViewById (R.id.nest_scrollview); scrollView.setFillViewport (true);

Disabling User dragging on BottomSheet

It can be now no longer relevant, but I will leave it here: import android.content.Context import android.util.AttributeSet import androidx.coordinatorlayout.widget.CoordinatorLayout import android.view.MotionEvent import android.view.View import com.google.android.material.bottomsheet.BottomSheetBehavior @Suppress(“unused”) class LockableBottomSheetBehavior<V : View> : BottomSheetBehavior<V> { constructor() : super() constructor(context: Context, attrs: AttributeSet) : super(context, attrs) var swipeEnabled = true override fun onInterceptTouchEvent( parent: CoordinatorLayout, child: V, event: … Read more

How to replace deprecated android.support.v4.app.ActionBarDrawerToggle

Adding only android-support-v7-appcompat.jar to library dependencies is not enough, you have also to import in your project the module that you can find in your SDK at the path \android-sdk\extras\android\support\v7\appcompatand after that add module dependencies configuring the project structure in this way otherwise are included only the class files of support library and the app … Read more

How to add Action Bar from support library into PreferenceActivity?

EDIT: In appcompat-v7 22.1.0 Google added the AppCompatDelegate abstract class as a delegate you can use to extend AppCompat’s support to any activity. Use it like this: … import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatDelegate; import android.support.v7.widget.Toolbar; … public class SettingsActivity extends PreferenceActivity { private AppCompatDelegate mDelegate; @Override protected void onCreate(Bundle savedInstanceState) { getDelegate().installViewFactory(); getDelegate().onCreate(savedInstanceState); super.onCreate(savedInstanceState); } @Override … Read more

FloatingActionButton example with Support Library

So in your build.gradle file, add this: compile ‘com.android.support:design:27.1.1′ AndroidX Note: Google is introducing new AndroidX extension libraries to replace the older Support Libraries. To use AndroidX, first make sure you’ve updated your gradle.properties file, edited build.gradle to set compileSdkVersion to 28 (or higher), and use the following line instead of the previous compile one. … Read more

How to add footer to NavigationView – Android support design library?

If you want a fixed (non-scrolling) footer in your navigation menu, you need wrap NavigationView around another layout, like you’ve posted. NavigationView works like FrameLayout, so this ends up “stacking” the inner layout on top of the NavigationView menu items. Here’s one way to arrange it, using LinearLayout for the footer items: Fixed Footer <android.support.design.widget.NavigationView … Read more

Recycler view inside NestedScrollView causes scroll to start in the middle

I solved such issue by setting: <ImageView … android:focusableInTouchMode=”true”/> to my view above RecyclerView (which was hidden after unwanted scroll). Try to set this property to your LinearLayout above RecyclerView or to LinearLayout which is container of RecyclerView (helped me in another case). As I see in NestedScrollView source it tries to focus the first … Read more