zoukankan      html  css  js  c++  java
  • 50、Toast自定义布局

    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();
  • 相关阅读:
    typescript
    pyqt5窗口跳转
    pyqt5 列表内添加按钮
    C#窗体最大化,其他控件调整
    C#禁止程序重复打开
    C#添加 mysql.data.dll
    宝塔一键ssl
    宝塔Linux面板 使用阿里云OSS备份数据
    CentOS7使用firewalld打开关闭防火墙与端口
    使用babel编译es6
  • 原文地址:https://www.cnblogs.com/androidsj/p/4761060.html
Copyright © 2011-2022 走看看