Rendering issue in XML preview : Unable to locate mode 0 [duplicate]

That’s problem with RecyclerView in com.android.support:design:25.0.0 Maybe there is some issue in that version. Changed version to 24.1.1 solved my problem. compile ‘com.android.support:appcompat-v7:24.1.1’ compile ‘com.android.support:support-v13:24.1.1’ compile ‘com.android.support:design:24.1.1’ in case you not have not removed the default provided gradle imports change this also androidTestCompile ‘com.android.support:support-annotations:24.2.1’

Android XML: android:elevation vs. app:elevation

Hope I can help, Let’s talk with an example: <android.support.design.widget.FloatingActionButton android:layout_height=”wrap_content” android:layout_width=”wrap_content” … android:elevation=”@dimen/elevation_medium” /> The android:elevationattribute will work from the API level 21 and upper. <android.support.design.widget.FloatingActionButton android:layout_height=”wrap_content” android:layout_width=”wrap_content” … app:elevation=”@dimen/elevation_medium” /> In this case the app:elevation attribute belongs to the FloatingActionButton styleable, inside de Android Design Support Library which will work from version 4 … Read more

How to combine BottomAppBar + FAB with BottomNavigationView

First Way Try this You can Create a CustomBottomNavigationView Here is the good article for CustomBottomNavigationView How I draw custom shapes in BottomNavigationView SAMPLE CODE import android.content.Context; import android.graphics.*; import android.support.design.widget.BottomNavigationView; import android.support.v4.content.ContextCompat; import android.util.AttributeSet; public class CustomBottomNavigationView extends BottomNavigationView { private Path mPath; private Paint mPaint; /** the CURVE_CIRCLE_RADIUS represent the radius of the … Read more

Plural definition is ignored for zero quantity

According to the documentation : The selection of which string to use is made solely based on grammatical necessity. In English, a string for zero will be ignored even if the quantity is 0, because 0 isn’t grammatically different from 2, or any other number except 1 (“zero books”, “one book”, “two books”, and so … Read more

re-setting a TextView height programmatically

You should change it via LayoutParams: LayoutParams params = (LayoutParams) textView.getLayoutParams(); params.height = 70; textView.setLayoutParams(params); EDIT You should not use sizes in pixels in you code, use dimensions for this: dimens.xml: <dimen name=”text_view_height”>50dp</dimen> In code: params.height = getResources().getDimensionPixelSize(R.dimen.text_view_height);

Android button with different background colors

As your error states, you have to define drawable attibute for the items (for some reason it is required when it comes to background definitions), so: <?xml version=”1.0″ encoding=”utf-8″?> <selector xmlns:android=”http://schemas.android.com/apk/res/android”> <item android:state_pressed=”true” android:drawable=”@color/red”/> <!– pressed –> <item android:state_focused=”true” android:drawable=”@color/blue”/> <!– focused –> <item android:drawable=”@color/black”/> <!– default –> </selector> Also note that drawable attribute doesn’t … Read more

Programmatically change color of shape in layer list

<layer-list xmlns:android=”http://schemas.android.com/apk/res/android”> <item android:id=”@+id/gradientDrawble”> // Give id <shape android:shape=”rectangle”> <solid android:color=”#000000″ /> // CHANGE THIS COLOR </shape> </item> <item android:left=”5dp”> <shape android:shape=”rectangle”> <solid android:color=”@color/bg” /> </shape> </item> </layer-list> Then in you code just add LayerDrawable layerDrawable = (LayerDrawable) getResources() .getDrawable(R.drawable.my_drawable); GradientDrawable gradientDrawable = (GradientDrawable) layerDrawable .findDrawableByLayerId(R.id.gradientDrawble); gradientDrawable.setColor(color); // change color Update Oct-2016 getDrawable() is now … Read more

How to add a horizontal 1px line above image view in a relative layout?

Just add the following line in your XML where ever you want it. <View android:background=”#ffffff” android:layout_width = “match_parent” android:layout_height=”1dp”/> Edit: Try this: <RelativeLayout android:id=”@+id/widget38″ android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:layout_x=”108px” android:layout_y=”87px” > <View android:id=”@+id/separator” android:background=”#ffffff” android:layout_width = “fill_parent” android:layout_height=”1dip” android:layout_centerVertical =”true” android:layout_alignParentTop=”true”/> <ImageView android:id=”@+id/widget39″ android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:layout_below=”@id/separator” android:layout_alignParentRight=”true” /> </RelativeLayout>

Android getMeasuredHeight returns wrong values !

You’re calling measure incorrectly. measure takes MeasureSpec values which are specially packed by MeasureSpec.makeMeasureSpec. measure ignores LayoutParams. The parent doing the measuring is expected to create a MeasureSpec based on its own measurement and layout strategy and the child’s LayoutParams. If you want to measure the way that WRAP_CONTENT usually works in most layouts, call … Read more

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