在android中的进度指示器下方显示文本

在android中的进度指示器下方显示文本,第1张

概述从一个屏幕切换到另一个屏幕时,我正在显示进度条.它是圆形进度条,其中有一条消息“正在加载”此消息显示在进度栏的右侧.我想在圆形载荷下方显示它.可能吗?progressDialog=ProgressDialog.show(test2.this,"","Initializing",false);Threadthread=newThread(newRunnabl

从一个屏幕切换到另一个屏幕时,我正在显示进度条.
它是圆形进度条,其中有一条消息“正在加载”
此消息显示在进度栏的右侧.
我想在圆形载荷下方显示它.可能吗?

progressDialog = ProgressDialog.show(test2.this, "", "Initializing", false); Thread thread=new Thread(new Runnable(){     public voID run(){         startActivity(new Intent(test2.this, test.class));         runOnUiThread(new Runnable(){             public voID run() {                 if(progressDialog.isShowing())                     progressDialog.dismiss();         }}); }}); thread.start(); 

解决方法:

为此,您必须创建一个自定义对话框,如下所示,对其进行修改以适合您的需求

public static voID showProgressDialog(Context mContext, String text, boolean remove){    mDialog = new Dialog(mContext, androID.R.style.theme_Translucent_NoTitlebar_Fullscreen);    mDialog.requestwindowFeature(Window.FEATURE_NO_Title);    LayoutInflater mInflater = LayoutInflater.from(mContext);    VIEw layout = mInflater.inflate(R.layout.popup_example, null);    mDialog.setContentVIEw(layout);    TextVIEw mTextVIEw = (TextVIEw) layout.findVIEwByID(R.ID.text);    if (text.equals(""))        mTextVIEw.setVisibility(VIEw.GONE);    else        mTextVIEw.setText(text);    mDialog.setCancelable(remove);    // aiImage.post(new Starter(activityIndicator));    mDialog.show();}

popup_example.xml

<?xml version="1.0" enCoding="utf-8"?><relativeLayout    xmlns:androID="http://schemas.androID.com/apk/res/androID"    androID:layout_wIDth="fill_parent"    androID:layout_height="fill_parent">    <linearLayout        androID:layout_wIDth="wrap_content"        androID:layout_height="wrap_content"        androID:orIEntation="vertical"        androID:layout_centerInParent="true">        <Progressbar            androID:ID="@androID:ID/progress"                        androID:layout_wIDth="wrap_content"            androID:layout_height="wrap_content"            androID:layout_marginleft="5dip"></Progressbar>        <TextVIEw            androID:ID="@+ID/text"            androID:layout_wIDth="wrap_content"            androID:layout_height="wrap_content"            androID:text="Loading Content"            androID:layout_margin="10dip"            androID:textcolor="#FFFFFF"            androID:layout_gravity="center_vertical" />    </linearLayout></relativeLayout>
总结

以上是内存溢出为你收集整理的在android中的进度指示器下方显示文本全部内容,希望文章能够帮你解决在android中的进度指示器下方显示文本所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1070668.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-26
下一篇 2022-05-26

发表评论

登录后才能评论

评论列表(0条)

保存