SHARE
TWEET

ListView...

ua6xh Oct 9th, 2013 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top