1 <?xml version="1.0" encoding="utf-8"?> 2 <shape xmlns:android="http://schemas.android.com/apk/res/android" > 4 <solid android:color="@color/black" /> 6 <corners android:radius="10dp" /> 8 </shape>
1 <?xml version="1.0" encoding="utf-8"?> 2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 3 android:id="@+id/layout_my_dialog_cahce" 4 android:layout_width="wrap_content" 5 android:layout_height="wrap_content" 6 android:paddingTop="30dp" 7 android:paddingBottom="20dp" 8 android:paddingLeft="70dp" 9 android:paddingRight="70dp" 10 android:background="@drawable/my_dialog_cache_bg" 11 android:gravity="center" 12 android:orientation="vertical" > 14 <ImageView 15 android:src="@drawable/my_center_dialog_ok" 16 android:layout_width="wrap_content" 17 android:layout_height="wrap_content" /> 19 <TextView 20 android:text="清除成功" 21 android:textColor="@color/white2" 22 android:textSize="16sp" 23 android:layout_marginTop="10dp" 24 android:layout_width="wrap_content" 25 android:layout_height="wrap_content" /> 27 </LinearLayout>
1 Toast toast = new Toast(mActivity); 2 View view = LayoutInflater.from(mActivity).inflate(R.layout.my_center_cache_dialog, null); 3 4 LinearLayout layout_my_dialog_cahce = (LinearLayout) view.findViewById(R.id.layout_my_dialog_cahce); 6 layout_my_dialog_cahce.getBackground().setAlpha(95); 7 8 toast.setView(view); 10 toast.setGravity(Gravity.CENTER, 0, 0); 12 toast.show();
时间: 2024-10-09 20:32:54