Working with density-independent pixels
1px / 1dp = 160dpi / 160dpi
2px / 1dp = 320dpi / 160dpi
※ dpi = dot per inch
7inch nexus^7 1280x800pixel => 960x600dp
Density buckets
LDPI, MDPI, HDPI, XHDPI, XXHDPI, XXXHDPI
res/drawable/checkbox.xml
<selector> <item android:state_pressed="true" android:state_checked="true" android:drawable="@drawable/box_checked_pressed"> <item android:state_pressed="true" android:drawable="@drawable/box_pressed"> <item android:state_checked="true" android:drawable="@drawable/box_checked"> <item android:drawable="@drawable/box_default"> </selector>
content, padding, margins
FrameLayout, LinearLayout, RelativeLayout, GridLayout, ScrollView, ListView, ViewPager
styles.xml
<resources> <!-- Base application theme. --> <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> <!-- Customize theme here --> </style> <style name="MyStyle"> <item name="android:textColor">#FF255F26</item> </style> <style name="AnotherStyle"> <item name="android:textColor">#1D175F</item> <item name="android:textStyle">bold</item> </style> </resources>