Android : How to programmatically set layout_constraintRight_toRightOf “parent”

Here is an example of setting a button to the bottom of parent view using java code: ConstraintLayout constraintLayout; ConstraintSet constraintSet; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); constraintLayout = (ConstraintLayout) findViewById(R.id.activity_main_constraint_layout); Button button = new Button(this); button.setText(“Hello”); constraintLayout.addView(button); constraintSet = new ConstraintSet(); constraintSet.clone(constraintLayout); constraintSet.connect(button.getId(), ConstraintSet.LEFT, constraintLayout.getId(), ConstraintSet.RIGHT, 0); constraintSet.constrainDefaultHeight(button.getId(), 200); constraintSet.applyTo(constraintLayout); } to … Read more

FloatingActionButton with text instead of image

Thanks to all. Here is easy workaround which I found for this question. Works correctly for Android 4+, for Android 5+ is added specific parameter android:elevation to draw TextView over FloatingActionButton. <FrameLayout android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:layout_gravity=”bottom|right”> <android.support.design.widget.FloatingActionButton android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:src=”https://stackoverflow.com/questions/33671196/@android:color/transparent” /> <TextView android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:layout_gravity=”center” android:text=”@android:string/ok” android:elevation=”16dp” android:textColor=”@android:color/white” android:textAppearance=”?android:attr/textAppearanceMedium” /> </FrameLayout>

How can I install “Android Support Library” to deploy a Gluon Mobile application to Android?

It has been asked here and here, but since the answers are in different contexts, maybe it’s worthy having a summary here. Up until version 1.2.0, the jfxmobile plugin has been working with the obsolete Android Support Library. Now this library is not only obsolete but not available any more for download. The current version … Read more

Android error – Caused by: java.lang.NoClassDefFoundError: android.support.v4.util.SparseArrayCompat

Right Click on your project -> Build Path -> Configure Build Path -> Order and Export Tab. Make sure that “Android Private Libraries” is checked for Export. If you’ve added any libraries from the libs/ folder, remove them as they are automatically added in the “Android Private Libraries” section.

Fragment must be a public static class to be properly recreated from instance state

The error is not especially weird. If you were not getting this error before, that was weird. Android destroys and recreates fragments as part of a configuration change (e.g., screen rotation) and as part of rebuilding a task if needed (e.g., user switches to another app, your app’s process is terminated while it is in … Read more

How can we work-around the blank title in PagerTitleStrip and PagerTabStrip?

An interim solution while waiting for a patched release is to use a copy of the latest known good version of these classes (22.1.0) instead of the one bundled with the support library. Drop the attached files into your project and setup your ViewPager with these classes instead. Note: do not change their package name … Read more

Error when using any Android Design Support Library Elements

In addition to Emmanuel’s answer you could be facing the following problem. It seems like the design library components need a style which is based on an AppCompat Theme. So try to use “Theme.AppCompat.[…]” as a parent in your style.xml. Example: <!– Base application theme. –> <style name=”AppTheme” parent=”Base.AppTheme”> <!– Customize your theme here. –> … Read more

Android support library error after updating to 23.3.0

For those people who are still facing this problem just add this line to your dependencies. androidTestCompile ‘com.android.support:support-annotations:23.3.0′ It solved my problem. UPDATE: If you have this error nowadays, you can just insert the new versioncode (23.3.0 in this case, or 27.1.1 in May ’18) as it is described in the error into the above … Read more

add ‘tools:replace=”Android:value”‘ to element at AndroidManifest

Problem is that all support libraries with same version and major version has to match compile SDK version. So try to force a specific support library version. Put this at the end of your app module in build.gradle. configurations.all { resolutionStrategy.eachDependency { DependencyResolveDetails details -> def requested = details.requested if (requested.group == ‘com.android.support’) { if … Read more