我在Galaxy Tab 10.1上有一个看起来像这样的ProgressDialog"
在Galaxy Tab 7上就像这样

我希望两个Dialogs看起来都一样:
我得到的最接近的是使用以下样式
<style name="popupStyle" parent="android:Theme.Dialog">
<item name="android:textColor">#FFFFFFFF</item>
<item name="android:background">#FF000000</item>
<item name="android:windowBackground">@android:color/transparent</item>
</style>
这导致了这一点

所以我的问题是:
- 如何删除"请稍候"标题周围的边框?
- 如何将整体边框从蓝色更改为白色?
- 如何调整/缩小宽度?
我正在尝试创建一个ProgresBar如下所示的内容:

到目前为止,我已经创建了一个扩展ProgressBar的对象,现在我想弄清楚我的下一步是什么.
我知道我需要覆盖onDraw()一些逻辑,这些逻辑将决定要着色的方块数.这是微不足道的.
我不知道该怎么做就是首先得到这些方块.如何替换默认的drawable,所以当我在布局中添加自定义栏时,我可以看到像我的图像?
我尝试在单击提交按钮时显示进度栏。当数据加载完成时它将隐藏。但是,进度条没有覆盖全屏。相反,它被按钮覆盖。请参考截图,应该更容易理解我的意思。
我想要实现的是屏幕截图的底部部分。
Main4Activity.java
public class Main4Activity extends AppCompatActivity {
ProgressBar progressBar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main4);
progressBar = (ProgressBar) findViewById(R.id.progressBar);
progressBar.setVisibility(View.GONE);
final EditText username=(EditText)findViewById(R.id.username);
final EditText email=(EditText)findViewById(R.id.email);
final EditText password=(EditText)findViewById(R.id.password);
final Button submit=(Button)findViewById(R.id.submit);
submit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
progressBar.setVisibility(View.VISIBLE);
final String get_username=username.getText().toString();
final String get_email=email.getText().toString();
final String get_password=password.getText().toString();
Response.Listener<String> response_listener=new Response.Listener<String>() {
@Override
public void onResponse(String response) {
try{
JSONObject jsonObject=new JSONObject(response);
boolean result=jsonObject.getBoolean("register_result");
progressBar.setVisibility(View.GONE);
if(result){
AlertDialog.Builder builder=new AlertDialog.Builder(Main4Activity.this);
builder.setMessage("Registration Done!")
.setNegativeButton("Back",null)
.create() …Run Code Online (Sandbox Code Playgroud) 使用setProgressDrawable了ProgressBar具有自定义颜色不给我们以正确的方式工作.我们在a的行中使用progressbars ListView,但仅当列表中有多个元素时才会显示进度.如果是一个元素,则进度条为空.
CursorAdapter.java:
public class CursorAdapter extends SimpleCursorAdapter {
public CursorAdapter(Context context, int layout, Cursor c, String[] from,
int[] to) {
super(context, layout, c, from, to);
}
public void bindView(View view, Context context, Cursor cursor) {
super.bindView(view, context, cursor);
updateProgressbar(view, cursor);
}
/**
* This method updates the progressbar using the "numberpages" and
* "currentpage" values.
*/
private void updateProgressbar(View view, Cursor cursor) {
ProgressBar progressBar = (ProgressBar) view
.findViewById(R.id.progressbarHorizontal);
progressBar.setProgressDrawable(view.getResources().getDrawable(
R.drawable.greenprogress));
progressBar.setMax(cursor.getInt(cursor.getColumnIndex("numberpages")));
progressBar.setProgress(cursor.getInt(cursor
.getColumnIndex("currentpage"))); …Run Code Online (Sandbox Code Playgroud) 如何使用进度条微调器显示AlertDialog?
按下按钮时,我希望它阻止UI,直到数据完成加载显示微调器和消息和标题.
我知道我需要使用asyncTask但是如何使用progressbar spinner显示对话框?
我正在尝试使用java 创建progressBar(不是progressBar对话框).
我无法使它工作,我得到的是:

(一个围绕圆圈的图像)
这是我的代码:
b4 = new Button(this);
t4 = new ProgressBar(this);
b4.setId(4);
b4.setText(SensorData.sensorName[4]);
b4.setTypeface(null, 1);
b4.setTextSize(15);
b4.setGravity(Gravity.LEFT);
b4.setTextColor(R.color.black);
b4.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.icon, 0); // down
// t4.setId(4);
t4.setPadding(20, 10, 10, 10);
t4.setIndeterminate(false);
t4.setProgress(0);
t4.setScrollBarStyle(ProgressBar.SCROLLBARS_OUTSIDE_INSET);
t4.setMax(100);
t4.setVisibility(t4.VISIBLE);
sensorsView.addView(b4, new TableLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
sensorsView.addView(t4, new TableLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
b4.setOnClickListener(this);
Run Code Online (Sandbox Code Playgroud)
我想要的是横向进度吧,你知道我该怎么办吗?谢谢.
有人可以向我解释如何使用分隔符实现进度条,如下图所示?

对于进度条,我使用的是https://github.com/akexorcist/Android-RoundCornerProgressBar, 但这似乎没有分隔符选项.
我是ListView并希望显示进度,直到图像没有使用Picasso库从服务器下载到ImageView,仍然显示ic_launcher drawable,同时将图像从服务器下载到ImageView,但如果我想显示进度怎么办?
Picasso.with(context)
.load(imageURL)
.transform(transformation)
.placeholder(R.drawable.ic_launcher)
.error(R.drawable.ic_launcher)
.into(viewHolder.imageView);
Run Code Online (Sandbox Code Playgroud) 如何ProgressBar在屏幕上制作圆形渐变?
我现在拥有的:
pb_shape.xml:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background">
<shape>
<corners android:radius="12dip" />
<stroke
android:width="1dip"
android:color="@color/primary_white" />
<gradient
android:angle="270"
android:centerColor="@color/primary_black"
android:centerY="0.5"
android:endColor="@color/primary_black"
android:startColor="@color/primary_black"/>
<padding
android:bottom="4dp"
android:left="4dp"
android:right="4dp"
android:top="4dp" />
</shape>
</item>
<item android:id="@android:id/progress">
<clip>
<shape>
<corners android:radius="12dip" />
<gradient
android:angle="0"
android:endColor="@color/primary_teal"
android:startColor="@color/primary_blue_dark" />
</shape>
</clip>
</item>
Run Code Online (Sandbox Code Playgroud)
<ProgressBar
android:id="@+id/pb_timer"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:progressDrawable="@drawable/pb_shape" />
Run Code Online (Sandbox Code Playgroud)
我已经尝试添加android:gradientRadius="12dip"到pb_shape但它不起作用.
我正在尝试创建一个圆角的正方形线进度条,以围绕图像绘制进度。
到目前为止,我有以下XML定义了我的圆角正方形线:
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<stroke
android:width="6dp"
android:color="@android:color/holo_green_light" />
<padding
android:left="5dp"
android:right="5dp"
android:bottom="5dp"
android:top="5dp" />
<corners android:radius="50dp" />
</shape>
Run Code Online (Sandbox Code Playgroud)
我知道这种解决方案:https : //github.com/mrwonderman/android-square-progressbar,但我对此并不感兴趣,因为效果不是我想要的。
我尝试在圆角正方形线的顶部创建一个普通圆,并尝试将其与PorterDuff合并,但是到目前为止,我也无法创建进度条效果。画一个圆圈,画出进度。
我还尝试过创建圆角正方形程序,以防XML膨胀被视为纯图像并且在PorterDuff合并过程中考虑了所有像素。但结果相同。