I'm making an application and at the end of the data inserts the user will see a summary with a listView
. So far so good, but I want to create, right after listview
, a finish button, but I can not seem to put it, if I put it inside the XML, it inserts the button inside all the items. How do I do this?
My XML:
<LinearLayout 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:orientation="vertical"
tools:context=".MainActivity">
<TextView
android:id="@+id/tema"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:textColor="#000000"
/>
<TextView
android:id="@+id/palavras"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:textColor="#000000"
/>
</LinearLayout>
My code:
public class MainActivity extends ListActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
String [] tema = new String[] {"Tema1", "Tema2", "Tema3"};
String [] tempo = new String[] {"1:20", "2:32", "1:10"};
String [] palavras = new String[] {"Palavras, curió, celular, computador","Camisa, mochila, Sara, SBC","Tunts, Tunts, Quero, ver"};
ArrayList<HashMap<String, String>> list = new ArrayList<HashMap<String,String>>();
for(int i=0; i<3; i++ ) {
HashMap<String,String> item = new HashMap<String,String>();
item.put("tema", tema[i]+": "+tempo[i]);
item.put("palavras", palavras[i]);
list.add(item);
}
// Simpler Adapter
String[] from = new String[] {"tema","palavras"};
int[] to = new int[] {R.id.tema, R.id.palavras};
setListAdapter(new SimpleAdapter(this,list,R.layout.activity_main,from,to));
}