Skip to content

Moster_03_Display selected data items#3

Merged
AnelCC merged 7 commits intomasterfrom
Moster_03_DisplaySelectedDataItems
Apr 18, 2020
Merged

Moster_03_Display selected data items#3
AnelCC merged 7 commits intomasterfrom
Moster_03_DisplaySelectedDataItems

Conversation

@AnelCC
Copy link
Copy Markdown
Owner

@AnelCC AnelCC commented Apr 18, 2020

Add a RecyclerView to layout fragment

1. Add a RecyclerView to fragment

     <androidx.recyclerview.widget.RecyclerView
            android:id="@+id/recyclerView"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_marginStart="8dp"
            android:layout_marginEnd="8dp"
            app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
            app:spanCount="2"
            tools:listitem="@layout/monster_grid_item" />

2. Create a RecyclerView item layout

@layout/monster_grid_item

item

3. Create a RecyclerView adapter class

Adapters provide a binding from an app-specific data set to views that are displayed.
RecyclerView display the data at the specified position. This should update the contents of the ViewHolder#itemView to reflect the item at the given position.
The ViewHolder which should be updated to represent the contents of the item at the given position in the data set.

     * within a {@link RecyclerView}.

4. Display images dynamically with Glide

Glide supports fetching and displaying video stills, images, and animated GIFs. Glide includes a flexible api that allows developers to plug in to almost any network stack. By default Glide uses a custom HttpUrlConnection based stack, but also includes utility libraries plug in to Google’s Volley project or Square’s OkHttp library instead.
Click Here

5. Add a dynamic background to data item

Implemented Resources Types as Color state list resource and Vector Drawables
Selectors Required. This must be the root element. Contains one or more elements.

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    ...
</selector>

Drawable resources is a general concept for a graphic that can be drawn to the screen. An XML file that defines a geometric shape, including colors and gradients. Creates a GradientDrawable.

<shape xmlns:android="http://schemas.android.com/apk/res/android">
...
</shape>

6. Refresh data with a swipe gesture

The SwipeRefreshLayout should be used whenever the user can refresh the contents of a view via a vertical swipe gesture. The activity that instantiates this view should add an OnRefreshListener to be notified whenever the swipe to refresh gesture is completed.

refresh_data

@AnelCC AnelCC merged commit 530b8bf into master Apr 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant