Material Design for Android
Material Design is a cross-platform design system for Google. Material Design provides detail specs from how text should be shown to how to layout a screen.
website: Material Design Website
MaterialComponents Theme
- implements material design by default.
- Uses theme attributes
- Customisable to your design
Using Material Design Theme Attributes
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fontFamily="@font/combo"
style="?attr/textAppearanceHeadline5" OR android:textAppearance="?attr/textAppearanceHeadline5"
android:text="@string/prasadam" />
Consistent Styling
Reuse color, size and create consistent padding between our different screens in app. We use following xml files for consistent styling.
Dimens
- Short for dimensions
- Allow you to easily apply consistent styling.
- Can change dimens based on screen size.
- Makes updating styles consistently easier.
- Can be dp for things like margins, heights or padding
- Sp for font sizes
- eg. Guidelines
Colors
- Material color system
- Define a few colors here
- It is used by all views
- Check the website : Color Tool to generate a automatically generated colors.xml file by picking colors.
RTL Languages
- Declare in manifest that app supports mirroring : android:supportsRtl="true"
- We need to use start and end instead of left and right in layout properties such as for padding and margins.
RTL APIs used :
- android:layoutDirection,
- android:textDirection ,
- android:textAlignment,
- getLayoutDirectionFromLocale()
Accessiblity Tools: Scanner
It scans your app and suggest improvements such as making touch targets larger, increasing contrasts and providing descriptions on images to make your app more accessible.
Comments
Post a Comment