You can have a custom row view and inflate your xml in its constructor: public MyRow extends LinearLayout { public MyRow(Context context) { super(context); LayoutInflater. From(context). Inflate(R.layout.
My_row, this, true); ... other initialization ... } } and then use merge in my_row. Xml :? Xml version="1.0" encoding="utf-8"?
> ... your row layout ...
You can have a custom row view and inflate your xml in its constructor: public MyRow extends LinearLayout { public MyRow(Context context) { super(context); LayoutInflater. From(context). Inflate(R.layout.
My_row, this, true); ... other initialization ... } } and then use merge in my_row. Xml: ... your row layout ... The merge element causes its children to be added as children of your custom view. Check out Merging Layouts for more info.
Thanks, that solves my problem! – dbrettschneider Apr 4 at 7:13.
I alwas use a custum Adapter with a viewholder like: public class CalendarAdapter extends BaseAdapter { protected static CalViewHolder holder; private LayoutInflater mInflater; public HashMap appointments = new HashMap(); public CalendarAdapter(Context context,HashMap set_appointments) { // Cache the LayoutInf mInflater = LayoutInflater. From(context); appointments = set_appointments; } @Override public int getCount() { // TODO Auto-generated method stub return appointments == null? 0:appointments.size(); } @Override public Object getItem(int arg0) { // TODO Auto-generated method stub return null; } @Override public long getItemId(int arg0) { // TODO Auto-generated method stub return 0; } @Override public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null) { convertView = mInflater.
Inflate(R.xml. Appointment, null); holder = new CalViewHolder(); holder. App_lay = (LinearLayout) convertView.
FindViewById(R.id. Appointment_layout); holder. App_head = (TextView) convertView.
FindViewById(R.id. Appointment_head); holder. App_body = (TextView) convertView.
FindViewById(R.id. Appointment_body); convertView. SetTag(holder); }else{ holder = (CalViewHolder) convertView.getTag(); } holder.
App_head. SetText(appointments. Get(position)0); holder.
App_body. SetText(appointments. Get(position)1); return convertView; } static class CalViewHolder { LinearLayout app_lay; TextView app_head; TextView app_body; } }.
I use this method too, but I have a lot of different layouts for the row, so there is a really big "if else". – dbrettschneider Apr 4 at 7:12 with many different layouts, the performance will slow down, I realised a similar Listview with up to six different holders, this is acceptable, but keep in mind, that you have to reload every single item, if you add or remove controls. Perhaps a listview is not really what you need, think about adding your views simply to a LinearLayout.
– 2red13 Apr 4 at 7:27.
The sections below explain how to create custom Views and use them in your application. For detailed reference information, see the View class. With your own class.
Override some of the methods from the superclass.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.