1
I have an Activity where I inflate custom items into a Listview. In setContentView() of this Activity I put a file that has only one Listview declared.
<ListView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/list_exercicios"
android:orientation="vertical"
android:clickable="true"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
In another XML file I create the layout of the items that go in Listview.
<LinearLayout
android:id="@+id/exercicios_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/exercicios_background"
android:orientation="vertical">
<TextView
android:id="@+id/pergunta"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/title_exercicios_background"
android:gravity="center"
android:text="Aqui vai a pergunta"
android:textColor="@color/letras_exercicios"
android:textSize="25sp" />
<RadioGroup
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RadioButton
android:id="@+id/radio_button_a"
android:layout_width="match_parent"
android:layout_height="50dp"
android:text="Aqui vai a perunta"
android:textColor="#FFFFFF"
style="@android:style/Widget.CompoundButton.CheckBox"/>
<RadioButton
android:id="@+id/radio_button_b"
android:layout_width="match_parent"
android:layout_height="50dp"
android:text="Aqui vai a perunta"
android:textColor="#FFFFFF"
style="@android:style/Widget.CompoundButton.CheckBox"/>
<RadioButton
android:id="@+id/radio_button_c"
android:layout_width="match_parent"
android:layout_height="50dp"
android:text="Aqui vai a perunta"
android:textColor="#FFFFFF"
style="@android:style/Widget.CompoundButton.CheckBox"/>
<RadioButton
android:id="@+id/radio_button_d"
android:layout_width="match_parent"
android:layout_height="50dp"
android:text="Aqui vai a perunta"
android:textColor="#FFFFFF"
style="@android:style/Widget.CompoundButton.CheckBox"/>
<RadioButton
android:id="@+id/radio_button_e"
android:layout_width="match_parent"
android:layout_height="50dp"
android:text="Aqui vai a perunta"
android:textColor="#FFFFFF"
style="@android:style/Widget.CompoundButton.CheckBox"/>
</RadioGroup>
<TextView
android:id="@+id/finished_question"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/terminei_background"
android:text="@string/txt_responder"
android:textSize="25sp"
android:textColor="#FFFFFF"
android:gravity="center"
android:onClick="terminou"/>
</LinearLayout>
The problem is that if I put the FAB in this file it appears in all the items and it doesn’t work, and if I put it in the Listview file it gives error.