Monday, November 16, 2015

How to add the ripple effect on any view

All you have to do is set your background to the ripple effect:
android:background="?attr/selectableItemBackground"
You can get the ripple effect on a TextView for example. (you can also try settings it on the android:foreground if background doesn't fit your use. If you do, the background has to be a solid color or @null though, so keep that in mind or using foreground won't work.)

Have fun !

Thursday, November 12, 2015

Here's how to center a background image

To customize background image scaling create a resource like this:
<xml version="1.0" encoding="utf-8"?>
 <xmlns:android="http://schemas.android.com/apk/res/android"
    android:gravity="center"
    android:src="@drawable/my_bg_asset" />
Then it will be centered in the view if used as background. There are also other flags:http://developer.android.com/guide/topics/resources/drawable-resource.html

Android Studio (and intelliJ) supports Sublime style multiple selections

Here is how they work:
  1. Add/remove a selection:
    1. Alt + Shift + Mouse Click
  2. Select/unselect the next occurrence:
    1. Alt + J / Shift + Alt + J (Ctrl + G / Shift + Ctrl +G) for Mac OS X)
  3. Select all occurrences:
    1. Shift + Ctrl + Alt + J (Ctrl + Cmd + G for Mac OS X)
  4. Clone caret above/below
    1. The shortcuts are not mapped by default. Simply open studio's preferences and search for clone in the keyboard mappings. I personally mapped it to Ctrl + Alt + Cmd + up and down
  5. Remove all selections:
    1. Esc
Multiple selections work nicely together with features like Code completion,Select word at caretJoin linesCopy/paste, and the others. Here’s a little demo:

Big thanks to  Andrey Cheptsov for this awesome bit of news! (source)