gpt4 book ai didi

Android TextInputLayout transitionName 和 transitionGroup - 目的是什么?

转载 作者:搜寻专家 更新时间:2023-11-01 09:26:23 25 4
gpt4 key购买 nike

我正在查看 firebaseUI auth project

我看到一些 TextInputLayouts 引用了 transitionName 和 transitionGroup 但我在网上找不到任何东西来帮助我理解如何使用它们以及真正的目的是什么:

这里有一个例子,请看android.support.design.widget.TextInputLayout的:

    <?xml version="1.0" encoding="utf-8"?>
<ScrollView
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:fillViewport="true"
android:layout_height="match_parent">

<RelativeLayout
style="@style/FirebaseUI.WrapperStyle">

<TextView
android:id="@+id/tv_title"
fontPath="fonts/Medium-Extd.otf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:layout_marginBottom="60dp"
android:text="@string/fui_welcome"
android:textAllCaps="true"
android:focusable="false"
android:clickable="false"
android:textColor="#ffffff"
android:layout_centerHorizontal="true"
android:textSize="14sp"
android:textStyle="bold"
tools:ignore="MissingPrefix"
tools:text="welcome" />

<android.support.design.widget.TextInputLayout
android:id="@+id/email_layout"
style="@style/FirebaseUI.TextInputLayout.EmailField"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:transitionGroup="true"
android:transitionName="@string/fui_email_field_name"
android:layout_below="@+id/tv_title"
app:errorEnabled="true"
tools:ignore="UnusedAttribute">

<android.support.design.widget.TextInputEditText
android:id="@+id/email"
android:textColor="@color/fui_white"
tools:text="johndoe@msn.com"
style="@style/FirebaseUI.TextInputEditText.EmailField" />

</android.support.design.widget.TextInputLayout>

<android.support.design.widget.TextInputLayout
android:id="@+id/name_layout"
android:layout_below="@+id/email_layout"
style="@style/FirebaseUI.TextInputLayout.NameField"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
app:errorEnabled="true">

<android.support.design.widget.TextInputEditText
android:id="@+id/name"
style="@style/FirebaseUI.TextInputEditText.NameField"
android:layout_width="match_parent"
tools:text="john doe"
android:maxLines="1"
android:layout_height="wrap_content" />

</android.support.design.widget.TextInputLayout>

<android.support.design.widget.TextInputLayout
android:id="@+id/password_layout"
style="@style/FirebaseUI.TextInputLayout.PasswordField"
android:layout_width="match_parent"
android:layout_below="@id/name_layout"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/fui_field_padding_vert"
app:errorEnabled="true"
app:passwordToggleTint="@color/fui_white"
app:passwordToggleEnabled="true">

<android.support.design.widget.TextInputEditText
android:id="@+id/password"
tools:text="123456789"
style="@style/FirebaseUI.TextInputEditText.PasswordField" />

</android.support.design.widget.TextInputLayout>

<TextView
android:id="@+id/create_account_text"
style="@style/FirebaseUI.Text.BodyText"
android:focusable="false"
android:layout_below="@+id/password_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/fui_field_padding_vert"
android:textIsSelectable="false"
tools:text="@string/fui_create_account_preamble_tos_and_pp" />

<Button
android:id="@+id/button_create"
style="@style/FirebaseUI.Button"
android:layout_width="match_parent"
android:layout_height="43dp"
android:text="@string/fui_signup"
tools:text="sign up"
fontPath="fonts/Medium-Extd.otf"
android:textColor="@color/fui_black"
android:layout_below="@id/create_account_text"
tools:ignore="MissingPrefix,RtlHardcoded" />

<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center_horizontal"
app:srcCompat="@drawable/fui_mylogo"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
/>
</RelativeLayout>

</ScrollView>

我试过不使用它们,但我仍然无法确定它的作用。

最佳答案

它们都处理共享元素转换。 Transition 包含有关在场景更改期间将在其目标上运行的动画的信息。基于文档:

transitionName

The name used of the View to be used to identify Views in Transitions or null if no name has been given.

它基本上是您的 View 的名称,将在转换期间用于识别目的。

是过渡组

Whether or not the ViewGroup should be treated as a unit in Activity transitions. If false, the ViewGroup won't transition, only its children. If true, the entire ViewGroup will transition together.

它确定是否应将 Transition 特性作为整个 ViewGroup 强加于该组的子级。

关于Android TextInputLayout transitionName 和 transitionGroup - 目的是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50265886/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com