Posts

Showing posts with the label Drawable

Android Button Drawable Tint

Image
Answer : You can achieve coloring the drawableleft on a button with this method: Step 1: Create a drawable resource file with bitmap as parent element as shown below and name it as ic_action_landscape.xml under the drawable folder <?xml version="1.0" encoding="utf-8"?> <bitmap xmlns:android="http://schemas.android.com/apk/res/android" android:src="@android:drawable/ic_btn_speak_now" android:tint="@color/white" /> Step 2: Create your Button control in your layout as below <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:backgroundTint="@color/md_light_green_500" android:drawableLeft="@drawable/ic_action_landscape" android:drawablePadding="8dp" android:fontFamily="sans-serif" android:gravity="left|center_vertical" android:stateListAn...

Android Mirror Vector Drawable

Image
Answer : For those who Use ImageView or TextView or EditText Scale works perfectly. Use android:scaleX="-1" //To flip horizontally or android:scaleY="-1" //To flip vertically OR Try android:rotationX="180" // for horizontal android:rotationY="180" // for vertical OR Simply rotation="180" for vertical android:rotation="180" // for vertical Edit: Additional If you want to flip/mirror icons/drawable when changing language RTL/LTR ("Right To Left"/"Left To Right"), there is a nice way of doing so in android vector drawable just check the ckeckbox Enable auto mirroring for RTL layout . => Right Click on drawable folder => New => Vector Asset => Select drawable => check the Checkbox . I am using AndroidStudio 3.0.1 in Windows 10 . well, there is no need to create another vector image, you can do it with one single vector image just make sure you do the following st...