Android Resource Formatting Standards

Naming

Layouts

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
                
    <ImageView
        android:id="@+id/char_img"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="10dp"
        android:layout_alignParentBottom="true"
        android:layout_alignParentRight="true"
        android:visibility="invisible"
        tools:visibility="visible"
        android:src="@drawable/img_char_bottom"/>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp">

        <Button
            android:id="@+id/skip_btn"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            style="@style/Button.Dialog.Skip"
            android:paddingLeft="24dp"
            android:paddingRight="24dp"
            android:text="@string/skip"/>

        <Button
            android:id="@+id/next_btn"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            style="@style/Button.Dialog.Next"
            android:text="@string/next"/>
    </LinearLayout>
</RelativeLayout>

Styles

<style name="HorizontalLine">
    <item name="android:layout_height">1dip</item>
    <item name="android:layout_width">match_parent</item>
</style>
<style name="HorizontalLine.Estimate">
    <item name="android:background">#ff8fa2b2</item>
</style>

<style name="EstimateNote">
    <item name="android:paddingLeft">36dip</item>
</style>
<style name="EstimateTotal">
    <item name="android:textSize">60sp</item>
</style>
Bad:
<style name="Button">
    <item name="android:textColor">#ffffffff</item>
</style>
<style name="Button.Green">
    <item name="android:background">@drawable/green_button_selector</item>
</style>
<style name="Button.Blue">
    <item name="android:background">@drawable/blue_button_selector</item>
</style>

Colors

Good:
<!-- Context free color definition -->
<color name="white">#ffffffff</color>
<color name="light_gray">#ffcccccc</color>
<color name="dark_gray">#ff333234</color>
<color name="dscout_teal">#ff02b2e0</color>

Bad:
<color name="ok_button_blue_color">#ff0000ff</color> <!-- This is now green? -->
Good:
<color name="snippet_detail_border_color">@color/white</color>
<color name="snippet_detail_bg_color">@color/light_gray</color>
<color name="snippet_question_title">@color/dscout_teal</color>
<color name="snippet_question_details">@color/dark_gray</color>

Strings

Dimensions

Additional Information

App Resources

Styles and Themes

String Resources

Dimension Resources