انجمن سایت کلیدستان


رتبه موضوع:
  • 0 رای - 0 میانگین
  • 1
  • 2
  • 3
  • 4
  • 5
گرید ویو سفارشی(custom gridview)

گرید ویو سفارشی(custom gridview)

#2
درود
اولا که به جای gridView از recyclerView استفاده کنید که خیلی بهینه تر و سبک تر هست
یه مثال ساده :
 
کد پی‌اچ‌پی:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:id="@+id/cv"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="8dp"
        app:cardBackgroundColor="@color/white"
        app:cardElevation="5dp">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_marginRight="10dp"
            android:orientation="vertical">


            <LinearLayout
                android:layout_marginTop="10dp"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="right"
                android:orientation="horizontal">

                <TextView
                    android:id="@+id/title_titr"
                    android:layout_width="wrap_content"
                    android:layout_height="90dp"
                    android:gravity="center_vertical"
                    android:paddingRight="10dp"
                    android:text="تیتر خبر"
                    android:textColor="@color/lightBlack"
                    android:textSize="18dp"/>

                <ImageView
                    android:contentDescription="عکس خبر"
                    android:id="@+id/img_titr"
                    android:layout_width="110dp"
                    android:layout_height="90dp"
                    android:scaleType="centerCrop"/>

            </LinearLayout>

            <View
                android:layout_width="match_parent"
                android:layout_height="1dp"
                android:layout_gravity="bottom"
                android:layout_marginLeft="10dp"
                android:layout_marginTop="5dp"
                android:background="@color/colorAccent"/>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="35dp"
                android:gravity="left"
                android:orientation="horizontal"
                android:paddingBottom="8dp"
                android:paddingTop="8dp">

                <ImageView
                    android:id="@+id/bookmark_news"
                    android:layout_width="35dp"
                    android:layout_height="match_parent"/>

                <ImageView
                    android:id="@+id/share_news"
                    android:layout_width="35dp"
                    android:layout_height="match_parent"/>

                <ImageView
                    android:layout_width="35dp"
                    android:layout_height="match_parent"
                    android:scaleType="fitEnd"/>

                <TextView
                    android:id="@+id/view_news"
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:gravity="center_vertical"
                    android:text="156165"/>

                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:gravity="right|center_vertical"
                    android:text="1394/5/8"/>
            </LinearLayout>

        </LinearLayout>
    </android.support.v7.widget.CardView> 




دوما خودتون باید آیتم های یک لیست رو طراحی کنید که بسیار ساده ست اما اگر میخواید از پروژه های آماده استفاده کنید بهتره سری به گیت هاب بزنید .


فایل‌های پیوست

عکس(ها)
   
پاسخ
 سپاس شده توسط shahramm ، hossein5513


پیام‌های این موضوع
گرید ویو سفارشی(custom gridview) - توسط shahramm - ۱۳۹۵/۰۱/۲۱, ۰۶:۳۰ ب.ظ
RE: گرید ویو سفارشی(custom gridview) - توسط دیب دمینی - ۱۳۹۵/۰۱/۲۱, ۰۸:۳۶ ب.ظ
RE: گرید ویو سفارشی(custom gridview) - توسط shahramm - ۱۳۹۵/۰۱/۲۱, ۰۸:۴۴ ب.ظ

پرش به انجمن:


کاربران در حال بازدید این موضوع: 1 مهمان