Advertisement
DmitryShupegin

Untitled

Jul 16th, 2019
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.54 KB | None | 0 0
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3.  
  4. xmlns:tools="http://schemas.android.com/tools"
  5. android:layout_width="match_parent"
  6. android:layout_height="match_parent"
  7. tools:context=".MainActivity">
  8.  
  9. <android.support.v7.widget.RecyclerView
  10. android:id="@+id/recyclerViews"
  11. android:layout_width="match_parent"
  12. android:layout_height="match_parent">
  13.  
  14. </android.support.v7.widget.RecyclerView>
  15.  
  16.  
  17. </FrameLayout>
  18.  
  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"
  26. android:layout_height="match_parent"
  27. >
  28.  
  29. <TextView
  30. android:id="@+id/tv_number_item"
  31. style="@style/TextAppearance.AppCompat.Title"
  32. android:layout_width="389dp"
  33. android:layout_height="wrap_content"
  34. android:layout_gravity="center_vertical|start"
  35. android:textAppearance="@style/TextAppearance.AppCompat" />
  36.  
  37.  
  38. <TextView
  39. android:id="@+id/tv_number_view_holder"
  40. style="@style/TextAppearance.AppCompat.Title"
  41. android:layout_width="wrap_content"
  42. android:layout_height="wrap_content"
  43. android:layout_gravity="center_vertical|end"
  44. android:textAppearance="@style/TextAppearance.AppCompat" />
  45.  
  46. </FrameLayout>
  47. ______________________________________________________________________________________________________________________________________
  48. package com.example.recyclerviewstest;
  49.  
  50.  
  51. import android.support.v7.app.AppCompatActivity;
  52. import android.os.Bundle;
  53. import android.support.v7.widget.LinearLayoutManager;
  54. import android.support.v7.widget.RecyclerView;
  55. import android.widget.LinearLayout;
  56.  
  57. public class MainActivity extends AppCompatActivity {
  58. private RecyclerView numberList;
  59. private NumberAdapter numberAdapter;
  60.  
  61. @Override
  62. protected void onCreate(Bundle savedInstanceState) {
  63. super.onCreate(savedInstanceState);
  64. setContentView(R.layout.activity_main);
  65.  
  66. numberList = findViewById(R.id.recyclerViews);
  67.  
  68. LinearLayoutManager layoutManager = new LinearLayoutManager(this);
  69. numberList.setLayoutManager(layoutManager);
  70. numberList.setHasFixedSize(true);
  71.  
  72. numberAdapter = new NumberAdapter(100);
  73. numberList.setAdapter(numberAdapter);
  74. }
  75. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement