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

您的位置:首頁技術文章
文章詳情頁

Android實現圓角彈框功能

瀏覽:38日期: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);//點擊其他區域時 true 關閉彈窗 false 不關閉彈窗 tvmydailog01 = findViewById(R.id.tv_mydailog01); tvmydailog02 = findViewById(R.id.tv_mydailog02); ivdailog = findViewById(R.id.iv_mydailog); } /*設置圖片接口*/ public void setImageResource(int resId){ ivdailog.setImageResource(resId); } /*設置文字接口*/ public void setText01(String str){ tvmydailog01.setText(str); } public void setText02(String str){ tvmydailog02.setText(str); } /*設置文字顏色接口*/ 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);//加載布局 //設置透明背景 Window window = getWindow(); window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); }}

Android實現圓角彈框功能

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://m.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>

調用

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

到此這篇關于Android實現圓角彈框功能的文章就介紹到這了,更多相關android圓角彈框內容請搜索好吧啦網以前的文章或繼續瀏覽下面的相關文章希望大家以后多多支持好吧啦網!

標簽: Android
相關文章:
主站蜘蛛池模板: 狠狠色丁香婷婷综合久久片 | 美女被强行扒开双腿激情视频 | 久久久久国产成人精品亚洲午夜 | 国产猛烈无遮掩视频免费网站男女 | 亚洲精品www | 亚洲a级片在线观看 | 成人午夜影院在线观看 | 精品久久在线 | 一级特黄一欧美俄罗斯毛片 | 日韩精品午夜视频一区二区三区 | 日韩一级在线播放免费观看 | 亚洲欧美日韩另类在线 | 欧美在线一级精品 | 视频一区久久 | 亚洲精品久久久久综合中文字幕 | 国产手机在线精品 | 亚洲精品一区二区三区美女 | 九九九九在线视频播放 | 97影院理论在线观看 | 欧美性色黄在线视 | 久久在视频 | 18lxxlxx日本| 久久欧美精品欧美久久欧美 | 国产精品久久久久毛片 | 精品午夜寂寞影院在线观看 | 国产三级在线观看a | 午夜不卡视频 | 日韩亚洲成a人片在线观看 日韩亚洲精品不卡在线 | 美女扒开腿让男生桶爽网站 | 在线视频中文字幕 | 夜夜爽影院 | 一级毛片免费不卡夜夜欢 | 九九热久久免费视频 | 免费看一毛一级毛片视频 | 91久久精一区二区三区大全 | 性欧美video另类bd | 自拍第一页 | 美女张开腿让男人桶爽动漫视频 | 欧美午夜三级我不卡在线观看 | 亚洲一区二区三区精品影院 | 国产在线视频网址 |