Guest User

Untitled

a guest
Jul 17th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.95 KB | None | 0 0
  1. private Spinner spMonto
  2. spMonto = (Spinner)view.findViewById(R.id.SpMonto);
  3. List<Integer> montos = new ArrayList<>();//cargar de la base de datos
  4. montos.add(100000);
  5. montos.add(200000);
  6. montos.add(300000);
  7. montos.add(400000);
  8. montos.add(500000);
  9. montos.add(600000);
  10. montos.add(700000);
  11. montos.add(800000);
  12. montos.add(900000);
  13. montos.add(1000000);
  14. adaptadorS = new AdaptadorTextViewSimple(montos,C);
  15. spMonto.setAdapter(adaptadorS);
  16. spMonto.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
  17. @Override
  18. public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
  19. TextView textView = (TextView)view.findViewById(R.id.txtText);
  20. montoSelec = Integer.parseInt(textView.getTag().toString());
  21. Log.i(Constantes.TAG,"montoX "+montoSelec);
  22.  
  23. }
  24.  
  25. @Override
  26. public void onNothingSelected(AdapterView<?> adapterView) {
  27.  
  28. }
  29. });
  30.  
  31. @Override
  32. public View getView(int i, View view, ViewGroup viewGroup) {
  33. LayoutInflater inflater = (LayoutInflater)C.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  34.  
  35. if (view==null){
  36. view=inflater.inflate(R.layout.text_view_simple,null);
  37. }
  38. TextView texto = (TextView)view.findViewById(R.id.txtText);
  39. texto.setFocusable(false);
  40.  
  41. texto.setText(String.valueOf(formatomil.format(integerList.get(i).intValue())));
  42. texto.setTag(integerList.get(i).intValue());
  43. return view;
  44. }
  45.  
  46. <?xml version="1.0" encoding="utf-8"?>
  47. <LinearLayout
  48. xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
  49. android:layout_height="match_parent"
  50. android:focusable="false" >
  51. <TextView
  52. android:focusable="false"
  53.  
  54. android:id="@+id/txtText"
  55. android:layout_width="match_parent"
  56. android:layout_height="50dp"
  57. android:gravity="center"
  58. android:inputType="textMultiLine"
  59. android:textColor="@color/Negro"
  60. android:textSize="20sp" />
Add Comment
Please, Sign In to add comment