2016-12-30 4 views
1

Weiß jemand, wie man ein erweiterbares Layout wie die Zahlungsmethode und den Link bekommt? Ich möchte nicht, dass es in einer Listenansicht ist, weil ich ein solches erweiterbares Layout für andere Dinge mit unterschiedlichem Inhalt brauche. Oder es könnte in einer erweiterbaren Listenansicht sein, wenn Artikel mit unterschiedlichen Inhalten eingebaut werden können. Vielen Dank im Voraus!Wie bekommt man solch ein erweiterbares Layout?

http://chairnerd.seatgeek.com/images/autocomplete_checkout.gif

Antwort

3

fand ich eine Lösung.

Put etwa wie folgt in Ihrer Layout-Datei

<com.github.aakira.expandablelayout.ExpandableRelativeLayout 
      android:id="@+id/expandableLayout4" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:layout_below="@+id/expandableButton4" 
      android:background="#ffcc80" 
      android:padding="16dp" 
      app:ael_duration="400" 
      app:ael_expanded="false" 
      app:ael_interpolator="accelerate" 
      app:ael_orientation="vertical"> 

      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:textColor="#FFFFFF" 
       android:text="Things to put in the expandable layout" /> 
     </com.github.aakira.expandablelayout.ExpandableRelativeLayout> 

In der Build gradle Datei

dependencies { 
compile 'com.github.aakira:expandable-layout:[email protected]'} 

Die Art und Weise onClick Zuhörer einzustellen für die Erweiterung des Layouts

public void expandableButton1(View view) { 
    expandableLayout1 = (ExpandableRelativeLayout) findViewById(R.id.expandableLayout1); 
    expandableLayout1.toggle(); // toggle expand and collapse 
} 

Weitere detaillierte Beschreibung: http://www.codeisall.com/android-expandable-layout/

Verwandte Themen