Files
android_development/samples/ApiDemos/res/layout/text_undo.xml
James Cook 5c42f75896 Re-enable the undo demo activity
The UI now shows these input fields:
* A normal field with buttons for programmatic SetText, append and insert.
* A field with undo disabled.
* A field with a length limit (via InputFilter).
* A field with a credit card input formatter (via TextWatcher)

Bug: 19332904
Change-Id: I41df56c84dd5232918e7ee5e6ed5874b2023cc78
2015-03-10 17:00:19 +00:00

113 lines
4.8 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2013 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- Demonstrates undo/redo behavior on a text field. -->
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent">
<LinearLayout android:orientation="vertical" android:padding="4dip"
android:layout_width="match_parent" android:layout_height="wrap_content">
<TextView android:id="@+id/default_edit_msg"
android:layout_width="match_parent" android:layout_height="wrap_content"
android:layout_weight="0" android:textAppearance="?android:attr/textAppearanceMedium"
android:paddingBottom="8dip"
android:text="@string/text_undo_default_edit_msg" />
<EditText android:id="@+id/default_text"
android:layout_width="match_parent" android:layout_height="wrap_content"
android:layout_weight="1"
android:textAppearance="?android:attr/textAppearanceMedium"
android:freezesText="true">
</EditText>
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:paddingTop="8dip">
<Button
android:id="@+id/set_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/text_undo_set_text"
android:layout_gravity="bottom" />
<Button
android:id="@+id/append_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/text_undo_append_text"
android:layout_gravity="bottom" />
<Button
android:id="@+id/insert_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/text_undo_insert_text"
android:layout_gravity="bottom" />
</LinearLayout>
<TextView android:id="@+id/undo_disabled_msg"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0"
android:textAppearance="?android:attr/textAppearanceMedium"
android:paddingBottom="8dip"
android:text="@string/text_undo_undo_disabled_msg" />
<EditText android:id="@+id/undo_disabled_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textAppearance="?android:attr/textAppearanceMedium"
android:freezesText="true"
android:allowUndo="false">
</EditText>
<TextView android:id="@+id/length_limit_msg"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0"
android:textAppearance="?android:attr/textAppearanceMedium"
android:paddingBottom="8dip"
android:text="@string/text_undo_length_limit_msg" />
<EditText android:id="@+id/length_limit_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textAppearance="?android:attr/textAppearanceMedium"
android:freezesText="true">
</EditText>
<TextView android:id="@+id/credit_card_msg"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0"
android:textAppearance="?android:attr/textAppearanceMedium"
android:paddingBottom="8dip"
android:text="@string/text_undo_credit_card_msg" />
<EditText android:id="@+id/credit_card_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textAppearance="?android:attr/textAppearanceMedium"
android:freezesText="true">
</EditText>
</LinearLayout>
</ScrollView>