2017-01-14 83 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

回答