Skip to content

Instantly share code, notes, and snippets.

@robillo
Created August 11, 2017 18:55
Show Gist options
  • Save robillo/b3192b36818b85cae1d91bd04a4454a0 to your computer and use it in GitHub Desktop.
Save robillo/b3192b36818b85cae1d91bd04a4454a0 to your computer and use it in GitHub Desktop.
activity main
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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"
android:gravity="center"
android:orientation="vertical"
tools:context="com.robillo.customviewstutorial.MainActivity">
<com.robillo.customviewstutorial.MyCustomView
android:layout_width="300sp"
android:layout_height="0sp"
app:square_color="@color/colorPrimary"
android:layout_weight="1"
android:layout_margin="5sp"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:layout_width="0sp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:id="@+id/one"
android:onClick="onClick"
style="?android:attr/buttonBarStyle"
android:background="?attr/selectableItemBackground"
android:text="CUSTOM PADDING +"/>
<Button
android:layout_width="0sp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:id="@+id/two"
android:onClick="onClick"
style="?android:attr/buttonBarStyle"
android:background="?attr/selectableItemBackground"
android:text="SWAP COLOR"/>
<Button
android:layout_width="0sp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:id="@+id/three"
android:onClick="onClick"
style="?android:attr/buttonBarStyle"
android:background="?attr/selectableItemBackground"
android:text="CUSTOM PADDING -"/>
</LinearLayout>
</LinearLayout>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment