Advertisement
ua6xh

ListView...

Oct 9th, 2013
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.82 KB | None | 0 0
  1. //В активити:
  2. NotificationsArrayAdapter adapter = new NotificationsArrayAdapter(this, R.layout.notifications, notifications);
  3. notificationsListView.setAdapter(adapter);
  4. notificationsListView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
  5.  
  6.  
  7. //В NotificationsArrayAdapter:
  8.  
  9. @Override
  10.     public View getView(int position, View convertView, ViewGroup parent) {
  11.     //...
  12.     ListView lvNotificationsGroups = (ListView) v.findViewById(R.id.subNotificationsList); // находим листвью
  13.     String[] names = { "Иван", "Марья", "Петр", "Антон" };
  14.     ArrayAdapter<String> adapter = new ArrayAdapter<String>(contextAdapter, android.R.layout.simple_list_item_1, names);
  15.         lvNotificationsGroups.setAdapter(adapter);
  16.         lvNotificationsGroups.setChoiceMode(ListView.CHOICE_MODE_SINGLE);      
  17.     //...
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement