بروز خطا
[message]
اشتراک در سوال
رای ها
[dataList]
ساخت Toast سفارشی
+1
0
به نظرم واسه اینکار میشه از Toastی که کاستومایز شده استفاده کرد (11 سال پیش)
0
0
فکر می کنم دقیقا باید همین کار رو بگنم و سوالم رو از "ساخت نوتیفیکیشن (notification) در داخل برنامه" به ساخت Toast سفارشی شده تغییر بدم ;) ممنون (11 سال پیش)
+1
0
فکر می کنم دقیقا باید همین کار رو بگنم و سوالم رو از "ساخت نوتیفیکیشن (notification) در داخل برنامه" به ساخت Toast سفارشی شده تغییر بدم ;) ممنون (11 سال پیش)
0
0
استفاده از Toast خوبه ولی محدودیت هایی داره، استفاده از دیالوگ رو بهتون پیشنهاد میکنم (11 سال پیش)
برای این سوال 1 پاسخ وجود دارد.
پاسخ به سوال
سپهر
11 سال پیش
+6
0
برای این کار از سایت اندروید دولوپر و این لینک با روش زیر استفاده کردم :
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/toast_layout_root"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="8dp"
android:background="#DAAA"
>
<ImageView android:src="@drawable/droid"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="8dp"
/>
<TextView android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#FFF"
/>
</LinearLayout>
LayoutInflater inflater = getLayoutInflater();
View layout = inflater.inflate(R.layout.custom_toast,
(ViewGroup) findViewById(R.id.toast_layout_root));
TextView text = (TextView) layout.findViewById(R.id.text);
text.setText("This is a custom toast");
Toast toast = new Toast(getApplicationContext());
toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0);
toast.setDuration(Toast.LENGTH_LONG);
toast.setView(layout);
toast.show();
پاسخگویی و مشاهده پاسخ های این سوال تنها برای اعضای ویژه سایت امکان پذیر است .
چنانچه تمایل دارید به همه بخش ها دسترسی داشته باشید میتوانید از این بخش لایسنس این آموزش را خریداری نمایید .
