Postingan

Menampilkan postingan dari November, 2019

Recycler View dengan OnItemClickListener

Gambar
hello temen2, yuk kita akhiri kelas Recycler View dengan metode OnItemClickListener 1. langkah pertama kita buka kelas CardViewHeroAdapter, package com.example.myrecyclerview; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; import com.bumptech.glide.Glide; import com.bumptech.glide.request.RequestOptions; import java.util.ArrayList; public class CardViewHeroAdapter extends RecyclerView.Adapter<CardViewHeroAdapter.CardViewViewHolder> {     private ArrayList<Hero> listHero;     public CardViewHeroAdapter(ArrayList<Hero> list){         this.listHero = list;     }     @NonNull     @Override     public CardViewViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int viewType) {  

Recycler View dengan Metode CardView

Gambar
hello temen2, yuk kita selesaikan projek kita, sekarang kita akan menggunakan Recycler View dengan metode CardView ini merupakan lanjutan dari materi  "Recycler View dengan metode Grid" 1. langkah pertama,buat layout baru dengan nama "item_cardview_hero" <?xml version="1.0" encoding="utf-8"?> <androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:card_view="http://schemas.android.com/apk/res-auto"     xmlns:tools="http://schemas.android.com/tools"     android:id="@+id/card_view"     android:layout_width="match_parent"     android:layout_height="wrap_content"     android:layout_gravity="center"     android:layout_marginLeft="8dp"     android:layout_marginTop="4dp"     android:layout_marginRight="8dp"     android:layout_marginBottom="4dp"     card_view:cardCorne

Recycler View dengan Metode Grid

Gambar
hello temen2, yuk lanjut belajar, pelajaran ini adalah pelajaran dari materi sebelumnya, yaitu "Recycler View dengan Metode List" 1. langkah pertama, membuat layout baru bernama "item_grid_hero" <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:tools="http://schemas.android.com/tools"     android:orientation="vertical"     android:layout_width="match_parent"     android:layout_height="wrap_content">     <ImageView         android:id="@+id/img_item_photo"         android:layout_width="match_parent"         android:layout_height="250dp"         android:layout_margin="1dp"         android:scaleType="centerCrop"         tools:scr="@color/colorAccent"/> </LinearLayout> 2. langkah kedua, buat adapter dengan membuat class de

Recycler View Mode List di Android studio

Gambar
hallo temen2, yuk kita belajar membuat list dengan Recycler View, 1. langkah pertama, tambahkan beberapa dependensi di build gradle(module app) apply plugin: 'com.android.application' android {     compileSdkVersion 29     buildToolsVersion "29.0.2"     defaultConfig {         applicationId "com.example.myrecyclerview"         minSdkVersion 15         targetSdkVersion 29         versionCode 1         versionName "1.0"         testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"     }     buildTypes {         release {             minifyEnabled false             proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'         }     } } dependencies {     implementation fileTree(dir: 'libs', include: ['*.jar'])     implementation 'androidx.appcompat:appcompat:1.0.2'     implementation 'androidx.constraintlayout:cons

Style dan Theme di Android Studio

Gambar
Hello temen2, yuk kita lanjut, bagaimana kalo, kita memakai style di projek kita kemarin, yuk kita buat... 1. langkah pertama, atur colors.xml di res > valeus > colors <?xml version="1.0" encoding="utf-8"?> <resources>     <color name="colorPrimary">#607D8B</color>     <color name="colorPrimaryDark">#455A64</color>     <color name="colorAccent">#FF5722</color>     <color name="colorSubTitle">#757575</color> </resources> 2. langkah kedua, kita buat stylenya di res > values > style <resources>     <!-- Base application theme. -->     <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">         <!-- Customize your theme here. -->         <item name="colorPrimary">@color/colorPrimary</item>         <item name="colorPrimaryDark&quo