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


رتبه موضوع:
  • 1 رای - 5 میانگین
  • 1
  • 2
  • 3
  • 4
  • 5
چرخش تصویری که از گالری کاربر انتخاب میشود (در برنامه نویسی اندروید)

چرخش تصویری که از گالری کاربر انتخاب میشود (در برنامه نویسی اندروید)

#5
ولی R.id.ImageView متناظر با عنصر ImageView در فایل xml است، نه عکسی که با آن سر و کار داریم. از این عبارت، برای ارجاع به یک عنصر ImageView با id برابر ImageView استفاده می کنیم. ما در پروژه اندروید، کلاسی (Class) با نام R داریم که این موارد در آن ذخیره می شود، اگر یک عنصر با id مشخص در پروژه اندروید بسازیم (در یک فایل xml)، عبارت مربوط به آن، مشابه R.id.ImageView است و کلمه id در آن عبارت قرار می گیرد، اما اگر عکسی را در پوشه های drawable از پروژه اندروید کپی کنیم، عبارتی مشابه عبارت R.drawable.myImage برای ارجاع به آن، در کلاس R ذخیره می شود که کلمه drawable در آن به کار رفته و از آن برای ارجاع به عکس مورد نظر استفاده می کنیم.
بد نیست کلاس R یک پروژه اندروید را باز کرده و نگاهی به آن بیندازید (آن را تغییر ندهید، چون این کلاس، به صورت خودکار تغییر پیدا می کند و نباید آن را دستکاری کنیم) :

   

به عنوان یک مثال :

کد پی‌اچ‌پی:
/* AUTO-GENERATED FILE.  DO NOT MODIFY.
 *
 * This class was automatically generated by the
 * aapt tool from the resource data it found.  It
 * should not be modified by hand.
 */

package com.kelidestan.com;

public final class 
{
    public static final class 
attr {
    }
    public static final class 
dimen {
        
/**  Default screen margins, per the Android Design guidelines. 

         Customize dimensions originally defined in res/values/dimens.xml (such as
         screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here.
    
         */
        
public static final int activity_horizontal_margin=0x7f040000;
        public static final 
int activity_vertical_margin=0x7f040001;
    }
    public static final class 
drawable {
        public static final 
int g=0x7f020000;
        public static final 
int ic_launcher=0x7f020001;
    }
    public static final class 
id {
        public static final 
int action_settings=0x7f080001;
        public static final 
int imageView1=0x7f080000;
    }
    public static final class 
layout {
        public static final 
int activity_main=0x7f030000;
    }
    public static final class 
menu {
        public static final 
int main=0x7f070000;
    }
    public static final class 
string {
        public static final 
int action_settings=0x7f050001;
        public static final 
int app_name=0x7f050000;
        public static final 
int hello_world=0x7f050002;
    }
    public static final class 
style {
        
/** 
        Base application theme, dependent on API level. This theme is replaced
        by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
    

            Theme customizations available in newer API levels can go in
            res/values-vXX/styles.xml, while customizations related to
            backward-compatibility can go here.
        

        Base application theme for API 11+. This theme completely replaces
        AppBaseTheme from res/values/styles.xml on API 11+ devices.
    
 API 11 theme customizations can go here. 

        Base application theme for API 14+. This theme completely replaces
        AppBaseTheme from BOTH res/values/styles.xml and
        res/values-v11/styles.xml on API 14+ devices.
    
 API 14 theme customizations can go here. 
         */
        
public static final int AppBaseTheme=0x7f060000;
        
/**  Application theme. 
 All customizations that are NOT specific to a particular API-level can go here. 
         */
        
public static final int AppTheme=0x7f060001;
    }


bookbook 
لطفا برای درج کد، از دکمه مخصوص درج کد در ادیتور انجمن استفاده کنید.
در مورد برنامه نویسی، مدیران تنها راهنمایی می کنند و نوشتن برنامه نهایی، به عهده کاربران می باشد (اینجا محلی برای یادگیری است، نه سفارش کدنویسی).
کاربران باید ابتدا خود به خطایابی برنامه بپردازند، نه اینکه به محض دیدن خطا، کدها را در انجمن، copy و paste کرده و از مدیران انتظار بررسی داشته باشند.
پاسخ
 سپاس شده توسط restless


پیام‌های این موضوع
RE: چرخش تصویری که از گالری کاربر انتخاب میشود (در برنامه نویسی اندروید) - توسط admin - ۱۳۹۳/۱۰/۲۶, ۱۱:۳۲ ب.ظ

پرش به انجمن:


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