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();
  • 相关阅读:
    vim常用命令
    转:CRF++总结1
    转:CRF++总结2
    并查集算法程序
    CRF++使用小结(转)
    并查集算法程序
    C#winform 画图
    转:字符识别
    转:A Survey On Relation Extraction
    转:生产计划问题
  • 原文地址:https://www.cnblogs.com/androidsj/p/4761060.html
Copyright © 2011-2022 走看看