السلام عليكم أحبابي في الله ،
في داخل ملف الادابتر الخاص بrecyclerviwer سنقوم باضافة الكود التالي
viewHolder.view_content.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(mcontext, Ar_Details_Activity.class);
intent.putExtra("ArabicZone_title",
feedList.get(viewHolder.getAdapterPosition()).getTitle("title"));
intent.putExtra("ArabicZone_description",
feedList.get(viewHolder.getAdapterPosition()).getDescription("description"));
intent.putExtra("ArabicZone_link",
feedList.get(viewHolder.getAdapterPosition()).getLink("link"));
intent.putExtra("ArabicZone_author",
feedList.get(viewHolder.getAdapterPosition()).getAuthor("author"));
intent.putExtra("ArabicZone_thumbnail",
feedList.get(viewHolder.getAdapterPosition()).getImage("thumbnail"));
mcontext.startActivity(intent);
}
});
هذا الكود سيختصر علينا عملية انشاء ملف والتعامل مع الضغطات ما قمنا به هو الاستفادة من خاصبة putextra المتوافدة في intent لانشاء context نختار الposition لكل عنصر وننقله لصفة الوصف رابط الكود للتوضيح اكثر
https://github.com/sadik-fattah/Android_Tutariel/blob/main/WinnMoney/app/src/main/java/com/guercifzone/winnmoney/Adapters/RecyclerViewAdapter.java
هنا السورس المخصص لتصميم صفحة الوصف
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".Ar_Details_Activity"
android:background="#303030">
<com.google.android.material.appbar.AppBarLayout
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
android:layout_width="match_parent"
android:layout_height="300dp"
android:id="@+id/appbarlayout_id">
<com.google.android.material.appbar.CollapsingToolbarLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/collapsingtoolbar_id"
app:layout_scrollFlags="exitUntilCollapsed|scroll"
app:title=" Title"
app:contentScrim="?attr/colorPrimary"
app:expandedTitleMarginStart="48dp"
app:expandedTitleMarginEnd="64dp">
<androidx.appcompat.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"
android:theme="@style/ThemeOverlay.AppCompat.Light">
</androidx.appcompat.widget.Toolbar>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="50dp">
<ImageView
android:layout_width="100dp"
android:layout_height="match_parent"
android:background="@drawable/loading_shape"
android:id="@+id/arabiczoneThumbnail"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="130dp"
android:orientation="vertical"
android:layout_margin="8dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/arabiczoneTitle"
android:text=" Title"
android:textStyle="bold"
android:textSize="18sp"/>
<TextView
android:layout_marginTop="5dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Link"
android:id="@+id/arabiczoneLink"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Author"
android:layout_marginTop="5dp"
android:id="@+id/arabiczoneAuthor"/>
</LinearLayout>
</LinearLayout>
</com.google.android.material.appbar.CollapsingToolbarLayout>
</com.google.android.material.appbar.AppBarLayout>
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:padding="16dp">
<TextView
android:textColor="#fff"
android:text="GuercifZone Description"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/arabiczoneDescription"/>
</androidx.core.widget.NestedScrollView>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
ستجدها في الرابط التالي
https://github.com/sadik-fattah/Android_Tutariel/blob/main/WinnMoney/app/src/main/res/layout/activity_ar_details.xml
الشرح في الفيديو التالي :
0 تعليقات