Android.app Fragments vs. android.support.v4.app using ViewPager?

You can use ViewPager with native fragments from the android.app package with the adapters from the android.support.v13.app package. You have to use the v13 support jar for that. There are two versions of the adapters that work with ViewPager, the ones in the v4 package are meant to be used with support fragments, the ones … Read more

Nested Recycler view height doesn’t wrap its content

@user2302510 solution works not as good as you may expected. Full workaround for both orientations and dynamically data changes is: public class MyLinearLayoutManager extends LinearLayoutManager { public MyLinearLayoutManager(Context context, int orientation, boolean reverseLayout) { super(context, orientation, reverseLayout); } private int[] mMeasuredDimension = new int[2]; @Override public void onMeasure(RecyclerView.Recycler recycler, RecyclerView.State state, int widthSpec, int heightSpec) … Read more

BottomNavigationView display both icons and text labels at all times

For anyone still looking for a solution and doesn’t want to rely on third party libraries or runtime reflection, BottomNavigationView in Support Library 28/Jetpack natively supports always having text label. This is the method you’re looking for. Or in XML, app:labelVisibilityMode=”labeled”

Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat

Run gradle -q dependencies (or gradle -q :projectName:dependencies) to generate a dependency report. You should see where r7 is coming from, such as: compile – Classpath for compiling the main sources. +— com.commonsware.cwac:camera-v9:0.5.4 | +— com.actionbarsherlock:actionbarsherlock:4.4.0 | | \— com.google.android:support-v4:r7 | +— com.commonsware.cwac:camera:0.5.4 | \— com.android.support:support-v4:18.0.+ -> 18.0.0 \— com.android.support:support-v4:18.0.+ -> 18.0.0 Then, use the … Read more

No resource found that matches the given name: attr ‘android:keyboardNavigationCluster’. when updating to Support Library 26.0.0

I was able to resolve it by updating sdk version and tools in gradle compileSdkVersion 26 buildToolsVersion “26.0.1” and support library 26.0.1 https://developer.android.com/topic/libraries/support-library/revisions.html#26-0-1

Cannot resolve symbol ‘AppCompatActivity’

A little addition to other answers here, for anyone having the same error while using the right lib version and the right class. When I upgraded to appcompat-v7:22.1.0 In which ActionBarActivity is deprecated and empty and AppCompatActivty is the way to go, due to some glitch in Android Studio, It didn’t quite pick up on … Read more

Difference between Activity and FragmentActivity

A FragmentActivity is a subclass of Activity that was built for the Android Support Package. The FragmentActivity class adds a couple new methods to ensure compatibility with older versions of Android, but other than that, there really isn’t much of a difference between the two. Just make sure you change all calls to getLoaderManager() and … Read more

How to make ConstraintLayout work with percentage values?

It may be useful to have a quick reference here. Placement of views Use a guideline with app:layout_constraintGuide_percent like this: <androidx.constraintlayout.widget.Guideline android:id=”@+id/guideline” android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:orientation=”vertical” app:layout_constraintGuide_percent=”0.5″/> And then you can use this guideline as anchor points for other views. or Use bias with app:layout_constraintHorizontal_bias and/or app:layout_constraintVertical_bias to modify view location when the available space allows … Read more

In android app Toolbar.setTitle method has no effect – application name is shown as title

Found the solution: Instead of: mActionBarToolbar = (Toolbar) findViewById(R.id.toolbar_actionbar); mActionBarToolbar.setTitle(“My title”); setSupportActionBar(mActionBarToolbar); I used: mActionBarToolbar = (Toolbar) findViewById(R.id.toolbar_actionbar); setSupportActionBar(mActionBarToolbar); getSupportActionBar().setTitle(“My title”); And it works.