Skip to content

Instantly share code, notes, and snippets.

@ronshapiro
Created November 22, 2015 02:41
Show Gist options
  • Save ronshapiro/c6b10b3c506f444d7ddf to your computer and use it in GitHub Desktop.
Save ronshapiro/c6b10b3c506f444d7ddf to your computer and use it in GitHub Desktop.
Sometimes I wish you could define inline resource values in Android XML that are scoped within their XML subtree.
<LinearLayout
android:variable:dimen:textSize="18sp">
<TextView
android:variable:dimen:paddingStartEnd="16dp"
android:variable:dimen:paddingTopBottom="16dp"
android:paddingStart="@local/paddingStartEnd"
android:paddingEnd="@local/paddingStartEnd"
android:paddingTop="@local/paddingTopBottom"
android:paddingBottom="@local/paddingTopBottom"
andorid:text="Local Variables"
android:textSize="@local/textSize" />
<TextView
andorid:text="Would make clean code and make simple styles not necessary"
android:textSize="@local/textSize" />
</LinearLayout>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment