2016-07-06 5 views
1

Ich versuche, eine benutzerdefinierte ListView mit jeder Gruppe von ListView Artikel des gleichen Typs zu erreichen, sollte ein Button/Blase Abzeichen über dem ersten Element dieser Gruppe schweben. Es soll wie folgt aussehen:Erzielen von Listview mit Blase wie Abzeichen auf Elementtyp?

Image

Wenn möglich, würde ich gerne wissen, wie die Hauptblase auf der Symbolleiste wechseln sich ändern, wenn die Gruppe von Elementtyp wurde bis hat gescrollt und erreichte es.

Antwort

2

versuchen, ein Bild-Knopf

Fügen Sie das Bild verwenden Sie die Taste wollen in Android halten: src =“"

Beispiel eines Layouts mit Hilfe von Image-Taste.

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:paddingLeft="@dimen/activity_horizontal_margin" 
    android:paddingRight="@dimen/activity_horizontal_margin" 
    android:paddingTop="@dimen/activity_vertical_margin" 
    android:paddingBottom="@dimen/activity_vertical_margin" 
    tools:context="com.example.shakthivels.assignment_8.FormActivity" 
    android:id="@+id/rl" 
    > 


    <EditText 
     android:layout_width="120sp" 
     android:layout_height="wrap_content" 
     android:id="@+id/editText" 
     android:layout_alignParentTop="true" 
     android:layout_alignParentStart="true" 
     android:hint="Name" /> 

    <EditText 
     android:layout_width="100sp" 
     android:layout_height="wrap_content" 
     android:id="@+id/editText2" 
     android:layout_alignBottom="@+id/editText" 
     android:layout_centerHorizontal="true" 
     android:hint="Height" 
     android:inputType="numberDecimal" 
     android:layout_alignParentTop="true" /> 

    <EditText 
     android:layout_width="120sp" 
     android:layout_height="wrap_content" 
     android:id="@+id/editText3" 
     android:layout_alignParentTop="true" 
     android:layout_alignParentEnd="true" 
     android:hint="Swag %" 
     android:inputType="number|numberDecimal" 
     android:layout_above="@+id/button" /> 

    <Button 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="New Button" 
     android:id="@+id/button" 
     android:layout_centerHorizontal="true" 
     android:onClick="onclickbutton" 
     android:layout_below="@+id/editText" /> 

    <android.support.v7.widget.RecyclerView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:id="@+id/view" 
     android:layout_alignParentBottom="true" 
     android:layout_alignParentStart="true" 
     android:layout_marginTop="150sp" 
     android:clickable="true" 
     android:onClick="DisplayName" 
     android:contextClickable="true" /> 

    <TextView 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:id="@+id/textView4" 
     android:layout_below="@+id/button" 
     android:layout_toStartOf="@+id/editText3" 
     android:layout_alignParentEnd="true" /> 
    <ImageButton 
     android:layout_width="70dp" 
     android:layout_height="70dp" 
     android:src="@mipmap/ic_launcher" 
     android:id="@+id/imageButton" 
     android:layout_gravity="right|bottom" 
     android:layout_marginLeft="15dp" 
     android:layout_marginRight="15dp" 
     android:layout_alignParentBottom="true" 
     android:layout_alignEnd="@+id/editText3" 
     android:onClick="RemoveFirst" /> 

</RelativeLayout> 
+0

Es beantwortet nicht wirklich meine Frage –