bahman2012 0 ارسال شده در ۹ بهمن ۱۳۹۳ گزارش اشتراک گذاری ارسال شده در ۹ بهمن ۱۳۹۳ سوال : چطور میتونم به همه button های یک اکتیویتی یک استایل خاص بدم سلام دوستان من چند فایل xml تو پروژه اندروییدیم دارم که میخام برای کل دکمه های هر اکتیویتی یک استایل خاص بدم----نمیخوام تک تک propertis براشون تعریف کنم... من اینو نوشتم اما فقط رو آخری تاثیر داره--دوستان اگه کسی بلده راهنماییم کنه--ممنون public class Maah extends Activity {Button b;public void ClickItem(View v){Intent intent=new Intent(Maah.this,Search_Ch_Mah.class); intent.putExtra("text",v.getTag().toString());startActivity(intent);}@Overrideprotected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.maah); b =(Button) findViewById(R.id.btn1); b =(Button) findViewById(R.id.btn2); b =(Button) findViewById(R.id.btn3); b =(Button) findViewById(R.id.btn4); b =(Button) findViewById(R.id.btn5); b =(Button) findViewById(R.id.btn6); b =(Button) findViewById(R.id.btn7); b =(Button) findViewById(R.id.btn8); b =(Button) findViewById(R.id.btn9); b =(Button) findViewById(R.id.btn10); b =(Button) findViewById(R.id.btn11); b =(Button) findViewById(R.id.btn12); b.setTypeface(Typeface.createFromAsset(getAssets(), "font/titr.ttf")); b.setTextColor(Color.parseColor("#b80606")); b.setTextSize(19);}} نقل قول لینک ارسال به اشتراک گذاری در سایت های دیگر
broken.heart 7 ارسال شده در ۹ بهمن ۱۳۹۳ گزارش اشتراک گذاری ارسال شده در ۹ بهمن ۱۳۹۳ سوال : چطور میتونم به همه button های یک اکتیویتی یک استایل خاص بدم سلام دوستان من چند فایل xml تو پروژه اندروییدیم دارم که میخام برای کل دکمه های هر اکتیویتی یک استایل خاص بدم----نمیخوام تک تک propertis براشون تعریف کنم... من اینو نوشتم اما فقط رو آخری تاثیر داره--دوستان اگه کسی بلده راهنماییم کنه--ممنون public class Maah extends Activity {Button b;public void ClickItem(View v){Intent intent=new Intent(Maah.this,Search_Ch_Mah.class); intent.putExtra("text",v.getTag().toString());startActivity(intent);}@Overrideprotected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.maah); b =(Button) findViewById(R.id.btn1); b =(Button) findViewById(R.id.btn2); b =(Button) findViewById(R.id.btn3); b =(Button) findViewById(R.id.btn4); b =(Button) findViewById(R.id.btn5); b =(Button) findViewById(R.id.btn6); b =(Button) findViewById(R.id.btn7); b =(Button) findViewById(R.id.btn8); b =(Button) findViewById(R.id.btn9); b =(Button) findViewById(R.id.btn10); b =(Button) findViewById(R.id.btn11); b =(Button) findViewById(R.id.btn12); b.setTypeface(Typeface.createFromAsset(getAssets(), "font/titr.ttf")); b.setTextColor(Color.parseColor("#b80606")); b.setTextSize(19);}} برای این کار باید تو شاخه res یه فولدر جدید به نام drawable ایجاد کنید و داخل اون پوشه یک XML درست کنید و به اون یه استایل خاص بدید با کد نویسیتون و بعد به خاصیت Background کلید هاتون این XML رو لینک بدید تا تمام خصوصیت هارو به یک باره شامل بشه... کد جاواشم اینه: NameBatton.setBackground( getResources().getDrawable(R.drawable.name_XML_sakhte_shode)); جای nameBatton باید اسم کلید رو بنویسی و جای name_XML_sakhte_shode باید اسم همون پروژه XML جدیدی که تو پوشه drawable درست کردی رو بزاری حالا بازم اگه بد توضیح دادم بگو تا به صورت تصویری برات بزارم تو تایپیک نقل قول لینک ارسال به اشتراک گذاری در سایت های دیگر
پست های پیشنهاد شده
به گفتگو بپیوندید
هم اکنون می توانید مطلب خود را ارسال نمایید و بعداً ثبت نام کنید. اگر حساب کاربری دارید، برای ارسال با حساب کاربری خود اکنون وارد شوید .