国产成人精品久久免费动漫-国产成人精品天堂-国产成人精品区在线观看-国产成人精品日本-a级毛片无码免费真人-a级毛片毛片免费观看久潮喷

您的位置:首頁(yè)技術(shù)文章
文章詳情頁(yè)

Android實(shí)現(xiàn)圓角彈框功能

瀏覽:28日期:2022-09-21 17:40:06

自定義彈窗類——Android 透明圓角彈窗

import android.content.Context;import android.graphics.Color;import android.graphics.drawable.ColorDrawable;import android.os.Bundle;import android.view.Window;import android.widget.ImageView;import android.widget.TextView;import androidx.annotation.NonNull;import androidx.appcompat.app.AlertDialog;public class MySetDailog extends AlertDialog { TextView tvmydailog01; TextView tvmydailog02; ImageView ivdailog; public MySetDailog(@NonNull Context context ) { super(context); setCanceledOnTouchOutside(true);//點(diǎn)擊其他區(qū)域時(shí) true 關(guān)閉彈窗 false 不關(guān)閉彈窗 tvmydailog01 = findViewById(R.id.tv_mydailog01); tvmydailog02 = findViewById(R.id.tv_mydailog02); ivdailog = findViewById(R.id.iv_mydailog); } /*設(shè)置圖片接口*/ public void setImageResource(int resId){ ivdailog.setImageResource(resId); } /*設(shè)置文字接口*/ public void setText01(String str){ tvmydailog01.setText(str); } public void setText02(String str){ tvmydailog02.setText(str); } /*設(shè)置文字顏色接口*/ public void setColor01(int color01){ tvmydailog01.setTextColor(color01); } public void setColor02(int color02){ tvmydailog02.setTextColor(color02); } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.dialog_mydailog);//加載布局 //設(shè)置透明背景 Window window = getWindow(); window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); }}

Android實(shí)現(xiàn)圓角彈框功能

xml布局文件

<?xml version='1.0' encoding='utf-8'?><LinearLayout xmlns:android='http://schemas.android.com/apk/res/android' android: android:layout_width='325dp' android:layout_height='162dp' android:paddingTop='15dp' android:orientation='vertical' android:layout_gravity='center_horizontal' android:gravity='center' android:background='@drawable/bg_round_dailog'> <ImageView android: android:layout_width='wrap_content' android:layout_height='66dp' android:src='http://www.cgvv.com.cn/bcjs/@drawable/icon_warning' /> <TextView android: android:layout_width='wrap_content' android:layout_height='wrap_content' android:layout_marginTop='@dimen/dp_12' android:maxLines='1' android:text='@string/str_upload_fail' android:textColor='#BB340F' android:textStyle='bold' android:textSize='18sp' /> <TextView android: android:layout_width='wrap_content' android:layout_height='wrap_content' android:text='@string/str_push_true_phone' android:textColor='#ff555555' android:textSize='15sp' /></LinearLayout>

調(diào)用

MySetDailog mySetDailog = new MySetDailog(BindActivity.this);mySetDailog.show();

到此這篇關(guān)于Android實(shí)現(xiàn)圓角彈框功能的文章就介紹到這了,更多相關(guān)android圓角彈框內(nèi)容請(qǐng)搜索好吧啦網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持好吧啦網(wǎng)!

標(biāo)簽: Android
相關(guān)文章:
主站蜘蛛池模板: 91国内精品久久久久怡红院 | 国产一区亚洲一区 | 2020夜夜操 | 一级特级aaa毛片 | 国产乱子精品免费视观看片 | 亚洲日韩中文字幕在线播放 | 免费国产成人综合 | 中文字幕在线乱码不卡区区 | 亚洲国产激情一区二区三区 | 成人国产精品毛片 | 久久综合免费视频 | 日本不卡免费高清一级视频 | 女人被男人躁得好爽免费视频免费 | 欧美白人和黑人xxxx猛交视频 | 午夜视频久久 | 欧美成人一级毛片 | 黄色成人免费网站 | 黄色一级网址 | 久久综合狠狠综合久久综合88 | 日韩色综合 | 亚洲一区二区三区不卡视频 | 精品久久久久久久久久香蕉 | aaaaaa毛片免费看 | 精品视频国产狼人视频 | 国内真实愉拍系列情侣 | 毛片韩国 | 亚洲中文字幕特级毛片 | 亚洲一区二区在线视频 | 成人免费国产欧美日韩你懂的 | 免费女人18毛片a级毛片视频 | 在线观看一区二区三区四区 | 精品视频国产狼人视频 | 国产亚洲精品一区二区在线观看 | 欧美亚洲视频一区 | 黄色美女网站视频 | 久久久国产精品免费看 | a级毛片免费全部播放 | 国产精品秦先生手机在线 | 日本高清视频一区二区 | 91久久国产视频 | 久久国产精品永久免费网站 |