بروز خطا
[message]
اشتراک در سوال
رای ها
[dataList]
مشکل customview
سلام دوستان یک custom view ساختم برای نمایش Dialog که به صورت زیر هست اما مشکل اینه بعضی مواقع در اندروید 5 به پایین یهو custom view کمرنگ میشه و random هست و تقریبا چیزهایی که داخلش هست قابل دیدن نیست ، همین مشکل با یک custom toolbar هم دارم.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="@+id/imageView7"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_marginTop="10dp"
android:background="@drawable/icon"/>
<TextView
android:id="@+id/txtTitle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_weight="1"
android:gravity="right"
android:padding="7dp"
android:text="عنوان"/>
</LinearLayout>
<TextView
android:id="@+id/txtSubject"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="40dp"
android:gravity="right"
android:padding="7dp"
android:text="متن"
tools:ignore="RtlHardcoded"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:id="@+id/btnYes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="2dp"
android:layout_weight="0.5"
android:background="@color/colorPrimary"
android:text="بله"
android:textColor="@color/btntext"/>
<Button
android:id="@+id/btnNo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="2dp"
android:layout_weight="0.5"
android:background="@color/colorPrimary"
android:text="خیر"
android:textColor="@color/btntext"/>
</LinearLayout>
</LinearLayout>
public class CustomDialogAlert {
private Dialog sDialog;
public void createAlertDialogYesNo(String title, String message, @NonNull String btnYesTxt, @NonNull String btnNoTxt, Button.OnClickListener onClickListenerYes, @Nullable Button.OnClickListener onClickListenerNo) {
AlertDialog.Builder alertDialog = new AlertDialog.Builder(GlobalController.getCurrentActivity());
View view = GlobalController.getCurrentActivity().getLayoutInflater().inflate(R.layout.custom_dialog, null);
TextView txtTitle = view.findViewById(R.id.txtTitle);
TextView txtSubject = view.findViewById(R.id.txtSubject);
Button btnYes = view.findViewById(R.id.btnYes);
Button btnNo = view.findViewById(R.id.btnNo);
if (!btnNoTxt.equals("") && !btnYesTxt.equals("")) {
btnYes.setText(btnYesTxt);
btnNo.setText(btnNoTxt);
}
txtTitle.setTypeface(GlobalController.typeface);
txtSubject.setTypeface(GlobalController.typeface);
btnYes.setTypeface(GlobalController.typeface);
btnNo.setTypeface(GlobalController.typeface);
txtTitle.setText(title);
txtSubject.setText(message);
alertDialog.setView(view).setCancelable(false);
sDialog = alertDialog.create();
if (onClickListenerNo == null) {
onClickListenerNo = new View.OnClickListener() {
@Override
public void onClick(View v) {
closeYesNoDialog();
}
};
}
btnYes.setOnClickListener(onClickListenerYes);
btnNo.setOnClickListener(onClickListenerNo);
sDialog.show();
}
0
0
استفاده از component این مشکلات رو بهمراه دارد لذا باید با توجه به ورژن ها مدیریت انجام گیرد یا خودتون لایبری رو ویرایش کنید و استفاده مورد لازم را ببرید. (8 سال پیش)
0
0
سلام منظور شماا از چه component هست ؟ چون من از چیز خاصی استفاده نکردم (8 سال پیش)
0
0
مثلا alerdialog یک لایبری یا کامپوننت آماده می باشد و اینگونه لایبری ها با توجه به ورژن متفاوت می باشد پیشنهادم راه های دیگری در این زمینه بررسی فرمایید. (8 سال پیش)
0
0
خب همین مشکل توی Toast و تولبار وجود داره که همه Custom هست مثلا یه custom toast با View اختصاصی چه راهکار جایگزینی دارد ؟ (8 سال پیش)
برای این سوال پاسخی وجود ندارد.
پاسخگویی و مشاهده پاسخ های این سوال تنها برای اعضای ویژه سایت امکان پذیر است .
چنانچه تمایل دارید به همه بخش ها دسترسی داشته باشید میتوانید از این بخش لایسنس این آموزش را خریداری نمایید .