使人们看到进度条从另一个类 [英] make visible ProgressBar from another class
本文介绍了使人们看到进度条从另一个类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想从另一个类显示MainActivity的进度。
I want to display ProgressBar of MainActivity from another class.
下面是MainActivity布局xml文件和Java类名称为main.java。
Here is Layout xml file of MainActivity and java class name is main.java.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/tabBar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#0844aa"
android:orientation="horizontal" >
<ProgressBar
android:id="@+id/progressBar1"
style="?android:attr/progressBarStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:visibility="invisible" />
</LinearLayout>
和默认是不可见的进度。但我想,以看得见这个进度从另一个类名为subclass.java。
And default is invisible for ProgressBar. But I want to make "visible" this ProgressBar from another class called "subclass.java".
推荐答案
创建BaseActivity,并有两个类扩展它。
Create a BaseActivity and have the both class extend it.
这篇关于使人们看到进度条从另一个类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文