Created
May 5, 2017 03:38
-
-
Save truongngoclinh/88768e68ee346a438dc7c00e2a4c7529 to your computer and use it in GitHub Desktop.
Spinner
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MyProgressDialog extends ProgressDialog { | |
private TextView mTvMessage; | |
private Context mContext; | |
public VedProgressDialog(Context context) { | |
super(context); | |
mContext = context; | |
setIndeterminate(true); | |
setCancelable(false); | |
} | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.view_progress_dialog); | |
mTvMessage = (TextView) findViewById(R.id.tv_message); | |
} | |
public void setMessage(String message) { | |
if (!TextUtils.isEmpty(message)) { | |
mTvMessage.setVisibility(View.VISIBLE); | |
mTvMessage.setText(message); | |
} else { | |
mTvMessage.setVisibility(View.GONE); | |
} | |
} | |
public void setMessage(int message) { | |
String msg = null; | |
if (message != -1) { | |
msg = mContext.getString(message); | |
} | |
setMessage(msg); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:background="@android:color/transparent" > | |
<LinearLayout | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:layout_centerInParent="true" | |
android:background="@android:color/transparent" | |
android:gravity="center_horizontal" | |
android:orientation="vertical" > | |
<ProgressBar | |
android:id="@+id/progress_bar" | |
style="?android:attr/progressBarStyle" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" /> | |
<TextView | |
android:id="@+id/tv_message" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:visibility="gone" /> | |
</LinearLayout> | |
</RelativeLayout> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment