2017-01-14 172 views
1

下图是表示我的问题。ANDROID卡扩展为表格布局

enter image description here

产品图1是由具有文本的视图的第一个活动。如果点击文本视图,它应该展开到图片2来填充一些细节。

我的问题是我该如何做到这一点?在android中是否有这个组件。我已经使用了它,但我无法找到解决方案?

图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> 
+0

将全部放在一个布局中,并将右侧图片的组件设置为可见通过。如果单击textview,则更改可见性。 – greenapps

回答