当先锋百科网

首页 1 2 3 4 5 6 7

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width
="match_parent"
android:layout_height
="match_parent"
android:orientation
="vertical"
>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height
="wrap_content"
>
<TextView
android:layout_width="wrap_content"
android:layout_height
="wrap_content"
android:text
="@string/patient_careplan_item_ui_bedid"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height
="wrap_content"
android:id
="@+id/patient_careplan_item_ui_patientBedId_id"
/>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height
="wrap_content"
>
<TextView
android:layout_width="wrap_content"
android:layout_height
="wrap_content"
android:text
="@string/patient_careplan_item_ui_patientname"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height
="wrap_content"
android:id
="@+id/patient_careplan_item_ui_patientName_id"
/>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height
="wrap_content"
>
<TextView
android:layout_width="wrap_content"
android:layout_height
="wrap_content"
android:text
="@string/patient_careplan_item_ui_careplanid"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height
="wrap_content"
android:id
="@+id/patient_careplan_item_ui_careplanId_id"
/>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height
="wrap_content"
>
<TextView
android:layout_width="wrap_content"
android:layout_height
="wrap_content"
android:text
="@string/patient_careplan_item_ui_doctortips"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height
="wrap_content"
android:id
="@+id/patient_careplan_item_ui_doctorTips_id"
/>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height
="wrap_content"
>
<TextView
android:layout_width="wrap_content"
android:layout_height
="wrap_content"
android:text
="@string/patient_careplan_item_ui_starttime"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height
="wrap_content"
android:id
="@+id/patient_careplan_item_ui_planStartTime_id"
/>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height
="wrap_content"
>
<TextView
android:layout_width="wrap_content"
android:layout_height
="wrap_content"
android:text
="@string/patient_careplan_item_ui_endtime"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height
="wrap_content"
android:id
="@+id/patient_careplan_item_ui_planEndTime_id"
/>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height
="wrap_content"
>
<TextView
android:layout_width="wrap_content"
android:layout_height
="wrap_content"
android:text
="@string/patient_careplan_item_ui_executetime"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height
="wrap_content"
android:id
="@+id/patient_careplan_item_ui_executeTime_id"
/>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height
="wrap_content"
>
<TextView
android:layout_width="wrap_content"
android:layout_height
="wrap_content"
android:text
="@string/patient_careplan_item_ui_executeperiod"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height
="wrap_content"
android:id
="@+id/patient_careplan_item_ui_executePeriod_id"
/>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height
="wrap_content"
>
<TextView
android:layout_width="wrap_content"
android:layout_height
="wrap_content"
android:text
="@string/patient_careplan_item_ui_planstate"
android:textColor
="@color/red"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height
="wrap_content"
android:id
="@+id/patient_careplan_item_ui_planState_id"
android:textColor
="@color/red"
/>
</LinearLayout>
</LinearLayout>
 
public class AdapterUtil extends BaseAdapter{
	private Context context;
	private List<Map<String, String>> data;
	private LayoutInflater inflater;
	class CarePlanListView {
		private TextView tv_bedId;
		private TextView tv_name;
		private TextView tv_planId;
		private TextView tv_doctorTips;
		private TextView tv_startTime;
		private TextView tv_endTime;
		private TextView tv_executeTime;
		private TextView tv_executePeriod;
		private TextView tv_planState;
	}
	public AdapterUtil (Context context,List<Map<String, String>> data) {
		this.context = context;
		this.data = data;
		this.inflater = LayoutInflater.from(context);
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return data.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return data.get(position);
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		CarePlanListView carePlanListView = null;
		if (convertView==null) {
			carePlanListView = new CarePlanListView();
			convertView = inflater.inflate(R.layout.patient_care_plan_item, null);
			carePlanListView.tv_bedId = 
					(TextView) convertView.findViewById(R.id.patient_careplan_item_ui_patientBedId_id);
			carePlanListView.tv_name = 
					(TextView) convertView.findViewById(R.id.patient_careplan_item_ui_patientName_id);
			carePlanListView.tv_planId = 
					(TextView) convertView.findViewById(R.id.patient_careplan_item_ui_careplanId_id);
			carePlanListView.tv_doctorTips = 
			(TextView) convertView.findViewById(R.id.patient_careplan_item_ui_doctorTips_id);
			carePlanListView.tv_startTime = 
					(TextView) convertView.findViewById(R.id.patient_careplan_item_ui_planStartTime_id);
			carePlanListView.tv_endTime = 
					(TextView) convertView.findViewById(R.id.patient_careplan_item_ui_planEndTime_id);
			carePlanListView.tv_executeTime = 
					(TextView) convertView.findViewById(R.id.patient_careplan_item_ui_executeTime_id);
			carePlanListView.tv_executePeriod = 
					(TextView) convertView.findViewById(R.id.patient_careplan_item_ui_executePeriod_id);
			carePlanListView.tv_planState = 
					(TextView) convertView.findViewById(R.id.patient_careplan_item_ui_planState_id);
			convertView.setTag(carePlanListView);
		}else {
			carePlanListView = (CarePlanListView) convertView.getTag();
		}
		carePlanListView.tv_bedId.setText(data.get(position).get("patientBedId"));
		carePlanListView.tv_name.setText(data.get(position).get("patientName"));
		carePlanListView.tv_planId.setText(data.get(position).get("careplanId"));
		carePlanListView.tv_doctorTips.setText(data.get(position).get("doctorTips"));
		carePlanListView.tv_startTime.setText(data.get(position).get("planStartTime"));
		carePlanListView.tv_endTime.setText(data.get(position).get("planEndTime"));
		carePlanListView.tv_executeTime.setText(data.get(position).get("executeTime"));
		carePlanListView.tv_executePeriod.setText(data.get(position).get("executePeriod"));
		carePlanListView.tv_planState.setText(data.get(position).get("planState"));
		if (data.get(position).get("planState").equals("已执行")) {
			carePlanListView.tv_planState.setTextColor(Color.YELLOW);
		}
		return convertView;
	}
}

 

转载于:https://www.cnblogs.com/alden/archive/2012/02/20/2359209.html