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();
  • 相关阅读:
    C# 观察者模式(Observer)
    CXGRID设置Selstart和SelLength
    Delphi 中相对路径与绝对路径、系统环境变量等相关函数说明
    用Delphi创建一个空的Access数据库
    非COM环境下的接口编程
    VCLZIP样例
    delphi 文件CRC32校验
    delphi中无类型文件读写
    Delphi调用MSSQL存储过程返回的多个数据集
    CXGRID,定位并高亮
  • 原文地址:https://www.cnblogs.com/androidsj/p/4761060.html
Copyright © 2011-2022 走看看