ANDROID 卡片展开为表单布局
ANDROID card expands to a form layout
下图是我的问题的表示。
图片 1 是第一个 activity,它具有文本视图。如果单击文本视图,它应该会扩展到图片 2 以填充一些细节。
我的问题是我怎样才能做到这一点? android 中是否有任何组件。我用谷歌搜索了这个,但找不到解决方案?
Pic 2 :- 用户在文本框或下拉列表中输入一些数据,用户提交。所以我带他去看第一张照片。
有什么想法吗?使用卡片视图我该怎么做?
下面是layout.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="THis is a first fragment layout"
/>
<android.support.v7.widget.CardView
android:id="@+id/card_view1"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:layout_marginBottom="10dp"
android:layout_marginEnd="20dp"
android:layout_marginStart="20dp"
android:layout_marginTop="10dp"
android:longClickable="true"
android:orientation="vertical"
card_view:cardCornerRadius="4dp"
card_view:cardElevation="4dp"
card_view:cardUseCompatPadding="true"
card_view:contentPadding="10dp"
>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="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:orientation="vertical">
<TextView
android:id="@+id/info_text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="#0000"
android:text="MY TEXT"
android:textAlignment="center"
android:textSize="24sp"
/>
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
需要使用Scene动画,按照教程进行
https://www.bignerdranch.com/blog/building-animations-android-transition-framework-part-1/
您可以在教程附带的 GIF 中看到类似的用例
下图是我的问题的表示。
图片 1 是第一个 activity,它具有文本视图。如果单击文本视图,它应该会扩展到图片 2 以填充一些细节。
我的问题是我怎样才能做到这一点? android 中是否有任何组件。我用谷歌搜索了这个,但找不到解决方案?
Pic 2 :- 用户在文本框或下拉列表中输入一些数据,用户提交。所以我带他去看第一张照片。
有什么想法吗?使用卡片视图我该怎么做?
下面是layout.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="THis is a first fragment layout"
/>
<android.support.v7.widget.CardView
android:id="@+id/card_view1"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:layout_marginBottom="10dp"
android:layout_marginEnd="20dp"
android:layout_marginStart="20dp"
android:layout_marginTop="10dp"
android:longClickable="true"
android:orientation="vertical"
card_view:cardCornerRadius="4dp"
card_view:cardElevation="4dp"
card_view:cardUseCompatPadding="true"
card_view:contentPadding="10dp"
>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="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:orientation="vertical">
<TextView
android:id="@+id/info_text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="#0000"
android:text="MY TEXT"
android:textAlignment="center"
android:textSize="24sp"
/>
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
需要使用Scene动画,按照教程进行
https://www.bignerdranch.com/blog/building-animations-android-transition-framework-part-1/
您可以在教程附带的 GIF 中看到类似的用例