تابستون داره تموم میشه ها، فرصت‌ها محدودن کلی آفر جذاب در کمپین تابستون🔥👇
۰ ثانیه
۰ دقیقه
۰ ساعت
۱ 7Learn Student
دسترسی به layout width یه ویو با جاوا
جامعه جاوا (اندروید) ایجاد شده در ۱۸ اردیبهشت ۱۴۰۱

چجوری اتریبیوت‌های layout width و layout height یه ویو رو مثلا از کلاس مین اکتیویتی مقداردهی کنیم؟

سلام وقت بخیر

در ادامه ویدیو‌ها اموزش داده شده اما میونید چنین کاری کنید :

// Gets linearlayout 
LinearLayout layout = findViewById(R.id.numberPadLayout);
// Gets the layout params that will allow you to resize the layout
LayoutParams params = layout.getLayoutParams();
// Changes the height and width to the specified *pixels*
params.height = 100;
params.width = 100;

یا مثلا برای ImageView :

imageView.getLayoutParams().height = 20;
imageView.requestLayout();
پوریا شفیعی ۱۸ اردیبهشت ۱۴۰۱، ۱۸:۵۲