我正在尝试创建一个应用程序,其唯一目的是显示 toast 通知。
Toast 通知的其中一件事是持续时间。目前,在 Android 中,两个默认值是LENGTH_SHORT
和LENGTH_LONG
。但是,在我的应用程序中,我想让用户选择自己的持续时间。
这个想法是,当他们按下“自定义长度”单选按钮时,视图将展开以显示另一个 EditText,允许他们输入自己的持续时间。但是,我想为这部分(入口和出口)设置动画。
问题是,我对 Android 动画一无所知。我也不知道应该使用哪种方法来处理 EditText(应该每次都创建和销毁它,还是存储在某个地方?)
如果您不确定我的意思,请考虑 iOS 的 WiFi 设置页面。当您启用 WiFi 时,网络会在它下面淡入,当您禁用它时,它们会淡出。
这是我的 RadioGroup XML:
<RadioGroup
android:layout_below="@+id/radioHint"
android:id="@+id/durationGroup"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<RadioButton
android:id="@+id/radioShort"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:checked="true"
android:text="@string/radioShort" />
<RadioButton
android:id="@+id/radioLong"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:text="@string/radioLong" />
<RadioButton
android:id="@+id/radioCustom"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:text="@string/radioCustom" />
</RadioGroup>
谢谢您的帮助。