EditText added is not a TextInputEditText. Please switch to using that class instead

I was wondering this too, Daniel Wilson gathered the documentation, but to the untrained eye it doesn’t mean much. Here’s what it’s all about: “extract mode” is referring to the type of view that’s shown when the space is too small, for example landscape on a phone. I’m using Galaxy S4 with Google Keyboard as … Read more

How to position below the lowest of two views in ConstraintLayout?

Now it’s possible with Barrier class, introduced in constraint-layout v1.1.0. So here’s the solution for your particular case: <?xml version=”1.0″ encoding=”utf-8″?> <android.support.constraint.ConstraintLayout 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:layout_height=”match_parent” tools:context=”com.example.eugene.test10.MainActivity”> <TextView android:id=”@+id/textView1″ android:layout_width=”0dp” android:layout_height=”wrap_content” android:background=”#EEEEEE” android:text=”TEXT_VIEW_1″ app:layout_constraintLeft_toLeftOf=”parent” app:layout_constraintTop_toTopOf=”parent” app:layout_constraintRight_toLeftOf=”@+id/textView2″/> <TextView android:id=”@+id/textView2″ android:layout_width=”0dp” android:layout_height=”wrap_content” android:background=”#DDDDDD” android:text=”TEXT_VIEW_2″ android:visibility=”gone” app:layout_constraintLeft_toRightOf=”@+id/textView1″ app:layout_constraintRight_toRightOf=”parent” app:layout_constraintTop_toTopOf=”parent” /> <android.support.constraint.Barrier android:id=”@+id/labelBarrier” android:layout_width=”wrap_content” android:layout_height=”wrap_content” app:barrierDirection=”bottom” app:constraint_referenced_ids=”textView1,textView2″ /> … Read more

Nested fragments disappear during transition animation

So there seem to be a lot of different workarounds for this, but based on @Jayd16’s answer, I think I’ve found a pretty solid catch-all solution that still allows for custom transition animations on child fragments, and doesn’t require doing a bitmap cache of the layout. Have a BaseFragment class that extends Fragment, and make … Read more

How to set support library snackbar text color to something other than android:textColor?

I found this at What are the new features of Android Design Support Library and how to use its Snackbar? This worked for me for changing the text color in a Snackbar. Snackbar snack = Snackbar.make(view, R.string.message, Snackbar.LENGTH_LONG); View view = snack.getView(); TextView tv = (TextView) view.findViewById(android.support.design.R.id.snackbar_text); tv.setTextColor(Color.WHITE); snack.show(); UPDATE: ANDROIDX: As dblackker points out … Read more

Set span for items in GridLayoutManager using SpanSizeLookup

The problem was that header should have span size of 2, and regular item should have span size of 1. So correct implementations is: mLayoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() { @Override public int getSpanSize(int position) { switch(mAdapter.getItemViewType(position)){ case MyAdapter.TYPE_HEADER: return 2; case MyAdapter.TYPE_ITEM: return 1; default: return -1; } } });