Advertisement
Guest User

Main Activity Snippet

a guest
Apr 28th, 2015
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. RecyclerView topList = (RecyclerView) findViewById(R.id.TopList);
  2. RecyclerView midList = (RecyclerView) findViewById(R.id.MidList);
  3. RecyclerView botList = (RecyclerView) findViewById(R.id.BotList);
  4. LinearLayoutManager topManager = new LinearLayoutManager(this);
  5. LinearLayoutManager midManager = new LinearLayoutManager(this);
  6. LinearLayoutManager botManager = new LinearLayoutManager(this);
  7. ImageAdapter topAdapter = new ImageAdapter(createList(1));
  8. topList.setAdapter(topAdapter);
  9.  
  10. ImageAdapter midAdapter = new ImageAdapter(createList(1));
  11. midList.setAdapter(midAdapter);
  12.  
  13. ImageAdapter botAdapter = new ImageAdapter(createList(1));
  14. botList.setAdapter(botAdapter);
  15.  
  16.  
  17. topManager.setOrientation(LinearLayoutManager.HORIZONTAL);
  18. midManager.setOrientation(LinearLayoutManager.HORIZONTAL);
  19. botManager.setOrientation(LinearLayoutManager.HORIZONTAL);
  20. topList.setHasFixedSize(true);
  21. midList.setHasFixedSize(true);
  22. botList.setHasFixedSize(true);
  23. topList.setLayoutManager(topManager);
  24. midList.setLayoutManager(midManager);
  25. botList.setLayoutManager(botManager);
  26.  
  27. }
  28.  
  29. private List createList(int size) {
  30. List result = new ArrayList();
  31. int num = getResources().getIdentifier("tshirt.png" , "drawable", getPackageName());
  32. ImageClass img = new ImageClass(num);
  33. result.add(img);
  34. return result;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement