Advertisement
Guest User

Untitled

a guest
Jul 25th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.42 KB | None | 0 0
  1. @Nullable
  2. @Override
  3. public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
  4. minha_view = inflater.inflate(R.layout.lista_notificacoes, container, false);
  5. return minha_view;
  6. }
  7.  
  8. @Override
  9. public void onActivityCreated(@Nullable Bundle savedInstanceState) {
  10. super.onActivityCreated(savedInstanceState);
  11. recupera_tarefa();
  12.  
  13. botao_deletar = (ImageView) getView().findViewById(R.id.botao_deletar);
  14.  
  15. botao_deletar.setOnClickListener(new View.OnClickListener() {
  16. @Override
  17. public void onClick(View v) {
  18. Toast.makeText(getContext(),"teste de mensagem",Toast.LENGTH_SHORT).show();
  19. }
  20. });
  21. }
  22.  
  23. <?xml version="1.0" encoding="utf-8"?>
  24. <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
  25. android:layout_width="match_parent" android:layout_height="match_parent">
  26.  
  27. <ListView
  28. android:layout_width="match_parent"
  29. android:layout_height="match_parent"
  30. android:divider="#000000"
  31. android:dividerHeight="2dp"
  32. android:id="@+id/list_notify"
  33. >
  34. </ListView>
  35. </FrameLayout
  36.  
  37. <?xml version="1.0" encoding="utf-8"?>
  38. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  39. xmlns:app="http://schemas.android.com/apk/res-auto"
  40. xmlns:tools="http://schemas.android.com/tools"
  41. android:layout_width="match_parent"
  42. android:layout_height="match_parent"
  43. android:orientation="horizontal">
  44.  
  45. <TextView
  46. android:id="@+id/numero_notificacao"
  47. android:layout_width="48dp"
  48. android:layout_height="48dp"
  49. android:layout_gravity="center"
  50. android:background="@drawable/circle"
  51. android:fontFamily="sans-serif"
  52. android:gravity="center"
  53. android:textColor="@android:color/white"
  54. android:textSize="16sp"
  55. android:text="texto"
  56. android:layout_marginTop="4dp"
  57. android:layout_marginLeft="4dp"
  58. android:layout_marginBottom="4dp"
  59.  
  60. />
  61.  
  62. <LinearLayout
  63. android:layout_width="0dp"
  64. android:layout_height="match_parent"
  65. android:layout_weight="1"
  66. android:orientation="vertical">
  67. <TextView
  68. android:id="@+id/texto_notificacao_list"
  69. android:layout_width="wrap_content"
  70. android:layout_height="wrap_content"
  71. android:layout_gravity="top"
  72. android:textColor="#000000"
  73. android:text="fedsfse"
  74. android:maxLines="1"
  75. android:ellipsize="end"
  76. android:layout_marginTop="8dp"
  77. android:layout_marginLeft="8dp"/>
  78. <TextView
  79. android:id="@+id/texto_hora_list"
  80. android:layout_width="wrap_content"
  81. android:layout_height="wrap_content"
  82. android:textColor="#000000"
  83. android:text="TextVie"
  84. android:layout_marginLeft="8dp" />
  85. </LinearLayout>
  86.  
  87. <ImageView
  88. android:layout_height="wrap_content"
  89. android:layout_width="wrap_content"
  90. android:src="@drawable/delete"
  91. android:id="@+id/botao_deletar"
  92. android:layout_gravity="center"
  93. android:layout_marginRight="8dp"/>
  94. </LinearLayout>
  95.  
  96. public class MeuAdapter extends BaseAdapter
  97.  
  98. LayoutInflater inflater = LayoutInflater.from(context);
  99. View view = convertView;
  100.  
  101. if(view == null){
  102. view = inflater.inflate(R.layout.item_lista, parent, false);
  103. }
  104.  
  105. //Inicializando Componentes
  106. ImageView botao_deletar = (ImageView) view.findViewById(R.id.botao_deletar);
  107.  
  108. botao_deletar.setOnClickListener(new View.OnClickListener() {
  109. @Override
  110. public void onClick(View v) {
  111. //Seu código
  112. }
  113. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement