summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Banes <chrisbanes@google.com>2015-10-21 11:17:17 +0100
committerChris Banes <chrisbanes@google.com>2015-10-21 11:17:17 +0100
commit88436bd9f4ca3ad21ec7f2b5a9d59909f99a4df7 (patch)
tree0ef2dd6fc9981cdb6b77498db5f6e0295c452416
parent3848c332a7e043ef84564f0dbf8c9dff78967abb (diff)
downloadandroid_development-88436bd9f4ca3ad21ec7f2b5a9d59909f99a4df7.tar.gz
android_development-88436bd9f4ca3ad21ec7f2b5a9d59909f99a4df7.tar.bz2
android_development-88436bd9f4ca3ad21ec7f2b5a9d59909f99a4df7.zip
Add demo for TextInputLayout's counter
Change-Id: I3a2453b6d5ad3d5ea2abd5de66c95a7db0bd6f83
-rw-r--r--samples/SupportDesignDemos/res/layout/design_text_input.xml40
-rw-r--r--samples/SupportDesignDemos/res/values/strings.xml1
2 files changed, 32 insertions, 9 deletions
diff --git a/samples/SupportDesignDemos/res/layout/design_text_input.xml b/samples/SupportDesignDemos/res/layout/design_text_input.xml
index 4561df125..32260746f 100644
--- a/samples/SupportDesignDemos/res/layout/design_text_input.xml
+++ b/samples/SupportDesignDemos/res/layout/design_text_input.xml
@@ -36,6 +36,24 @@
</android.support.design.widget.TextInputLayout>
+ <LinearLayout android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal">
+
+ <Button
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/show_error"
+ android:onClick="showError"/>
+
+ <Button
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/clear_error"
+ android:onClick="clearError"/>
+
+ </LinearLayout>
+
<android.support.design.widget.TextInputLayout
android:id="@+id/input_email"
android:layout_width="match_parent"
@@ -51,16 +69,20 @@
</android.support.design.widget.TextInputLayout>
- <Button
- android:layout_width="wrap_content"
+ <android.support.design.widget.TextInputLayout
+ android:id="@+id/input_description"
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:text="@string/show_error"
- android:onClick="showError"/>
+ android:layout_marginTop="8dp"
+ app:counterEnabled="true"
+ app:counterMaxLength="30">
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/clear_error"
- android:onClick="clearError"/>
+ <EditText
+ android:id="@+id/edit_description"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:hint="@string/form_description"/>
+
+ </android.support.design.widget.TextInputLayout>
</LinearLayout> \ No newline at end of file
diff --git a/samples/SupportDesignDemos/res/values/strings.xml b/samples/SupportDesignDemos/res/values/strings.xml
index a120337c1..ceb1aa65c 100644
--- a/samples/SupportDesignDemos/res/values/strings.xml
+++ b/samples/SupportDesignDemos/res/values/strings.xml
@@ -52,6 +52,7 @@
<string name="form_username">Username</string>
<string name="form_email">Email address</string>
+ <string name="form_description">Description</string>
<string name="show_error">Show error</string>
<string name="clear_error">Clear error</string>