Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?xml version="1.0" encoding="utf-8"?>
- <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- tools:context=".MainActivity">
- <android.support.v7.widget.RecyclerView
- android:id="@+id/recyclerViews"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
- </android.support.v7.widget.RecyclerView>
- </FrameLayout>
- ____________________________________________________________________________________________________________________________________
- <?xml version="1.0" encoding="utf-8"?>
- <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- >
- <TextView
- android:id="@+id/tv_number_item"
- style="@style/TextAppearance.AppCompat.Title"
- android:layout_width="389dp"
- android:layout_height="wrap_content"
- android:layout_gravity="center_vertical|start"
- android:textAppearance="@style/TextAppearance.AppCompat" />
- <TextView
- android:id="@+id/tv_number_view_holder"
- style="@style/TextAppearance.AppCompat.Title"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center_vertical|end"
- android:textAppearance="@style/TextAppearance.AppCompat" />
- </FrameLayout>
- ______________________________________________________________________________________________________________________________________
- package com.example.recyclerviewstest;
- import android.support.v7.app.AppCompatActivity;
- import android.os.Bundle;
- import android.support.v7.widget.LinearLayoutManager;
- import android.support.v7.widget.RecyclerView;
- import android.widget.LinearLayout;
- public class MainActivity extends AppCompatActivity {
- private RecyclerView numberList;
- private NumberAdapter numberAdapter;
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
- numberList = findViewById(R.id.recyclerViews);
- LinearLayoutManager layoutManager = new LinearLayoutManager(this);
- numberList.setLayoutManager(layoutManager);
- numberList.setHasFixedSize(true);
- numberAdapter = new NumberAdapter(100);
- numberList.setAdapter(numberAdapter);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement