I have this ListView in this Fragment, I need to be able to see the full string inside the item in the list, is it possible? It would be also better if the ListView could have different item heights with the different strings
This is the code:
Java:
package com.rs.donkey;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import java.util.ArrayList;
import java.util.List;
public class FragmentHomeworkNotDone extends Fragment {
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle saveInstanceState){
final View rootView = inflater.inflate(R.layout.fragment_homework, container,
false);
List<String> compiti = HomeworkActivity.compiti;
List<String> eseguiti = HomeworkActivity.eseguiti;
List<String> compitiDaFare = new ArrayList<String>();
for (int i = 0; i < compiti.size(); i++){
if (eseguiti.get(i).equals("F")){
compitiDaFare.add(compiti.get(i));
Log.i("COMPITI FATTI", compiti.get(i));
}
}
ListView compitiList = (ListView) rootView.findViewById(R.id.listaCompiti);
compitiList.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
ArrayAdapter<String> adapterCompiti = new ArrayAdapter<String>(this.getActivity(), android.R.layout.simple_list_item_checked, compitiDaFare);
compitiList.setAdapter(adapterCompiti);
return rootView;
}
}
XML:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:singleLine="false"
android:id="@+id/listaCompiti">
</ListView>
</RelativeLayout>