XML : Android - add Bar made in XML for items

I have an Activity, where Items should be added and I made a bar, which should be added for every item we have in this Activity.

This bar contains 4 Symbols (you can share, report, like and play a Soundfile)

For example the playSound-Button:

  <RelativeLayout      android:layout_width="match_parent"      android:layout_height="wrap_content">        <ImageButton          android:layout_width="wrap_content"          android:layout_height="wrap_content"          android:id="@+id/imageButton4"          android:background="@drawable/icon_play_32"          android:layout_gravity="right"          android:layout_alignParentTop="true"          android:layout_alignParentRight="true"          android:layout_alignParentEnd="true" />  </RelativeLayout>    

Now heres my XML for the Activity, I included the bar 2 times, but my problem is, that I'm not able to click the second play button:

  <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"      android:layout_width="match_parent"      android:layout_height="match_parent"      android:background="@color/babbel_darkgreen"      android:orientation="vertical"      android:weightSum="1">        <!-- Header einbinden -->      <include layout="@layout/header" />      <!--## Header einbinden -->        <ScrollView          android:id="@+id/scrollView3"          android:layout_width="wrap_content"          android:layout_height="wrap_content"          android:layout_gravity="top">            <ExpandableListView              android:id="@+id/expandableListView_dialectWordResult"              android:layout_width="wrap_content"              android:layout_height="wrap_content"              android:background="@color/babbel_lightgreen" />        </ScrollView>        <include      layout="@layout/activity_dialect_word_result_bar"      android:layout_width="match_parent"      android:layout_height="wrap_content"></include>        <include          layout="@layout/activity_dialect_word_result_bar"          android:layout_width="match_parent"          android:layout_height="wrap_content"></include>  </LinearLayout>    

How can I add the bar automatically for every Item added?

Further: How can I address the second button(or 3rd, 4th and so on)?

Thanks in advance!

No comments:

Post a Comment