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


رتبه موضوع:
  • 1 رای - 5 میانگین
  • 1
  • 2
  • 3
  • 4
  • 5
چجوری بین دکمه ها در اندروید فاصله بندازم؟

چجوری بین دکمه ها در اندروید فاصله بندازم؟

#3
(۱۳۹۴/۰۲/۳۰, ۱۰:۱۷ ب.ظ)'am5152' نوشته: با توجه به رفرنس زیر؛
http://stackoverflow.com/a/15187637/4900042
اگر اکتیویتی رو بصورت LinearLayout تعیین کرده باشید میتونید از خاصیت weight استفاده کنید:
کد پی‌اچ‌پی:
<LinearLayout
    android
:layout_width="match_parent"
    
android:layout_height="match_parent"
    
android:layout_alignParentBottom="true">
<
Button
    android
:id="@+id/button1"
    
android:layout_width="0dp"
    
android:layout_height="wrap_content"
    
android:layout_weight="1"
    
android:background="#99000099" />

<
Button
    android
:id="@+id/button2"
    
android:layout_width="0dp"
    
android:layout_height="wrap_content"
    
android:layout_weight="1"
    
android:background="#99990000" />
</
LinearLayout
ایکلیپس رو نمیدونم اما در androd studio خیلی کارتون راحت تر هست.
Layout_margin و بعد با استفاده از چند جهت مختلف با تنظیم کردن اندازه و مقادیر مورد نیاز میتونید کارتون رو انجام بدید.

برای سوال دوم هم باید فایل فونت رو در Assets کپی و با کد زیر شناسایی کنید:
کد پی‌اچ‌پی:
Button n = (ButtonfindViewById(R.id.button1);
 
Typeface typeface Typeface.createFromAsset(getAssets(), "font.ttf");
 
n.setText("show");
 
n.setTypeface(typeface); 

 

 

 


اوکی شد دمت گرم استاد...
 
پاسخ
 سپاس شده توسط am5152


پیام‌های این موضوع
RE: چجوری بین دکمه ها در اندروید فاصله بندازم؟ - توسط khunires - ۱۳۹۴/۰۲/۳۰, ۱۱:۰۰ ب.ظ

پرش به انجمن:


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