I would like to add an "ProgressBar" (like the one in Chrome for Android when you load a new webpage) to a List Item which will show the progress in the current lesson. (It's about an app for School, which all schedules).
Currently I have (Screenshot a bit outdated, I have managed to get the last divider with this fix):
You see on the screenshot after every item an divider, a gray line. I would like to replace this one with an progressbar (Not all dividers, just one. The same progressbar as Chrome for Android, when you load a new webpage). How I'm able to do this?
My current ScheduleAdapter:
package nl.devapp.ictcollege.adapters;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import java.util.List;
import nl.devapp.ictcollege.R;
import nl.devapp.ictcollege.models.Schedule;
public class ScheduleAdapter extends BaseAdapter {
private LayoutInflater inflater;
private List<Schedule> items;
public ScheduleAdapter(Context context, List<Schedule> list) {
this.items = list;
this.inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
@Override
public int getCount() {
if (this.items == null || this.items.isEmpty()) {
return 0;
} else {
return this.items.size();
}
}
@Override
public Schedule getItem(int position) {
return this.items.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View view = convertView;
if (convertView == null)
view = this.inflater.inflate(R.layout.row_schedule, null);
Schedule item = this.getItem(position);
TextView number = (TextView) view.findViewById(R.id.item_number);
TextView lesson = (TextView) view.findViewById(R.id.item_lesson);
TextView to = (TextView) view.findViewById(R.id.item_to);
TextView classRoom = (TextView) view.findViewById(R.id.item_class_room);
number.setText(Integer.toString(item.getHour()));
lesson.setText(item.getLesson());
to.setText(item.getTo());
classRoom.setText(item.getClassRoom());
return view;
}
}
and my FragmentSchedule xml (where I create the ListView):
<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"
tools:context="nl.devapp.ictcollege.fragments.SelectFragment">
<ListView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/rooster_list"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:footerDividersEnabled="true"
android:layout_alignParentStart="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:id="@+id/last_sync"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true" />
</RelativeLayout>
And my row_schedule:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/RelativeLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:paddingBottom="10dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="10dp" >
<TextView
android:id="@+id/item_number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true" />
<TextView
android:id="@+id/item_class_room"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true" />
<TextView
android:id="@+id/item_lesson"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginLeft="20dp"
android:layout_toRightOf="@+id/item_number" />
<TextView
android:id="@+id/item_to"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" />
</RelativeLayout>
Thanks!