Answer the question
In order to leave comments, you need to log in
How to competently organize the output of elements with several attributes from XML according to your template?
It is necessary to display data from the XML file on the screen according to your template, for example:
Element1
attribute 1 (TextView) attribute 2 (Spinner) attribute 3 (icon) [Button] (save changes button)
Element2
attribute 1 (TextView) attribute 2 (Spinner) attribute 3 (icon) [Button] (save changes button)
....
ElementN
attribute 1 (TextView) attribute 2 (Spinner) attribute 3 (icon) [Button] (save changes button)
What is the best way to implement such dynamic output? The ListView does not seem to fit - the entire line is clickable in it, but it is necessary that each element in this line be editable or clickable (Spinner, textView, etc., it doesn’t matter).
Answer the question
In order to leave comments, you need to log in
ListView does not seem to fit - the entire line is clickable in it
ListView listView = (ListView) findViewById(R.id.listView);
ListAdapter adapter = new ListAdapter() {
@Override
public View getView(int position, View convertView, ViewGroup parent) {
return LayoutInflater.from(getApplicationContext()).inflate(R.layout.list_item, null);
}
@Override public boolean areAllItemsEnabled() {return false;}
@Override public boolean isEnabled(int position) {return false;}
@Override public void registerDataSetObserver(DataSetObserver observer) {}
@Override public void unregisterDataSetObserver(DataSetObserver observer) {}
@Override public int getCount() {return 20;}
@Override public Object getItem(int position) {return null;}
@Override public long getItemId(int position) {return 0;}
@Override public boolean hasStableIds() {return false;}
@Override public int getItemViewType(int position) {return 0;}
@Override public int getViewTypeCount() {return 20;}
@Override public boolean isEmpty() {return false;}
};
listView.setAdapter(adapter);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question