Back to project page android.
The source code is released under:
Apache License
If you think the Android project android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.github.digin.android.adapters; /* w w w. ja v a2 s . c o m*/ import android.content.Context; import android.graphics.Typeface; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.TextView; import com.github.digin.android.NavDrawerItem; import com.github.digin.android.R; import java.util.List; public class NavDrawerAdapter extends ArrayAdapter<NavDrawerItem> { private int currentItem = 0; public NavDrawerAdapter(Context context, int resource, List<NavDrawerItem> objects) { super(context, resource, R.id.text, objects); } public int getCurrentItem() { return currentItem; } public void setCurrentItem(int position) { currentItem = position; notifyDataSetChanged(); } @Override public View getView(int position, View convertView, ViewGroup parent) { View v = super.getView(position, convertView, parent); TextView tv = (TextView) v.findViewById(R.id.text); if (position == currentItem) tv.setTypeface(Typeface.DEFAULT_BOLD); else tv.setTypeface(Typeface.DEFAULT); tv.setText(getItem(position).toString()); v.setTag(getItem(position)); return v; } }