我想制作一个像Inbox by Gmail安卓应用程序中的材料设计循环进度条.我如何实现这一点(在棒棒糖前设备中)?
我试图达到类似的效果. 收件箱通过Gmail材料设计循环进度条
我ProgressDialog用来显示进度条
ProgressDialog progressDialog = new ProgressDialog(context);
progressDialog.setCancelable(false);
progressDialog.setMessage(message);
progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
progressDialog.show();
Run Code Online (Sandbox Code Playgroud)
它就是这样的
我想将圆圈的绿色更改为红色.有什么办法吗?
我试过了
.getIndeterminateDrawable().setColorFilter(0xFFFFFFFF, android.graphics.PorterDuff.Mode.MULTIPLY);
Run Code Online (Sandbox Code Playgroud)
但不行.
我想改变Horizontal ProgressBar颜色
我试过这个
它不能正常运行蓝色
这是我的代码
<ProgressBar
android:id="@+id/mini_progress"
android:layout_marginLeft="10dip"
android:layout_marginRight="10dip"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="20dip"
android:layout_gravity="center_horizontal"
android:indeterminate="false"
android:indeterminateBehavior="repeat"
android:indeterminateOnly="true"
android:visibility="gone"/>
Run Code Online (Sandbox Code Playgroud)
我怎么能把颜色变成粉红色?
嘿伙计们,我为我的应用程序创建了这个进度条,但我不能得到那种看起来像红色或蓝色的黄色橙色.
<ProgressBar
android:id="@+id/progress_bar"
style="@android:style/Widget.ProgressBar.Horizontal"
android:layout_width="250sp"
android:layout_height="wrap_content"
android:progress="2"
android:layout_marginTop="82dp"
android:max="3"
android:indeterminate="false"
android:layout_below="@+id/imageView"
android:layout_centerHorizontal="true" />
Run Code Online (Sandbox Code Playgroud)
上面是我的进度条xml代码.
有帮助吗?:)
非常感谢提前!:)
我目前在通过gradle导入的Android项目中使用外部库.
此库显示带有ProgressBar圈的通知栏.这是我在其中找到的代码:
<ProgressBar
android:id="@+id/progress_bar"
android:layout_height="match_parent"
android:layout_marginBottom="4dp"
android:layout_marginTop="4dp"
style="@style/SuperActivityToast_Progress_ProgressBar"/>
Run Code Online (Sandbox Code Playgroud)
相关的风格是这样的:
<style name="SuperActivityToast_Progress_ProgressBar" parent="android:Widget.Holo.ProgressBar">
<item name="android:layout_width">32dp</item>
<item name="android:layout_marginLeft">8dp</item>
</style>
Run Code Online (Sandbox Code Playgroud)
如果我理解相关信息,则显示的圆圈颜色来自默认颜色(手机上的绿色).我需要改变它!
现在,我无法修改源代码,库本身也不能让我以编程方式设置样式.
有一种方法可以在应用级别更改默认样式或更好地覆盖此特定样式?
谢谢戴维德
有什么方法可以ProgressBar在运行时更改应用程序小部件中驻留的颜色?
这是ProgressBar进度值的更新方式:
RemoteViews views = new RemoteViews( context.getPackageName(), R.layout.widget );
views.setProgressBar( R.id.progressbar, 100, 10, false );
...
appWidgetManager.updateAppWidget( widgetID, views );
Run Code Online (Sandbox Code Playgroud)
不幸的是,该类RemoteViews不允许我们设置颜色过滤器,甚至不允许为ProgressBar.
任何想法,将不胜感激。
我在我的一个小部件中使用Android进度条:
<ProgressBar
android:layout_width="fill_parent"
android:layout_height="wrap_content"
style="?android:attr/progressBarStyleHorizontal"
android:id="@+id/progressbar_Horizontal"
android:max="100"/>
Run Code Online (Sandbox Code Playgroud)
在Android 2.x中它看起来很好,如下图所示.我在条形码本身上写了%.

但是,如果我改变Android Manifest
机器人:targetSdkVersion
到"15"进度条看起来完全不同.它现在是一条细蓝线而不是条形.问题是我在进度条上面写了一些文字,特别是进度的百分比.因此,当酒吧很薄,这看起来很奇怪.
我无法弄清楚如何再次增加杆的高度,例如50dp.如果我尝试android:layout_height ="50dp"它仍然保持相同的薄.
在布局文件中,我有以下内容:
android:layout_width="100dp"
android:layout_height="wrap_content" android:layout_marginRight="10dp"
android:text="SYN"
android:textAppearance="?android:attr/textAppearanceMedium"
android:background="@drawable/rectanglepurple"
android:textColor="#000000"
android:gravity="right"/>
Run Code Online (Sandbox Code Playgroud)
我试图使用代码实现以下目标,到目前为止我有:
Resources res = getResources();
Drawable drawable1=res.getDrawable(R.drawable.rectanglepurple);
TextView idText = new TextView(getActivity());
idText.setText("SYN");
idText.setTextAppearance(getActivity(), android.R.style.TextAppearance_Medium);
idText.setTextColor(Color.BLACK);
idText.setGravity(Gravity.RIGHT);
idText.setBackgroundDrawable(drawable1);
Run Code Online (Sandbox Code Playgroud)
我不能锻炼如何处理
android:layout_width="100dp"
android:layout_height="wrap_content" android:layout_marginRight="10dp"
Run Code Online (Sandbox Code Playgroud)
任何帮助赞赏.
我正在尝试ProgressBar使用中定义的自定义样式更改颜色style.xml
<ProgressBar
android:id="@+id/progress_bar"
style="@style/ProgressTheme"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:indeterminate="true"
android:indeterminateBehavior="repeat" />
Run Code Online (Sandbox Code Playgroud)
<style name="ProgressTheme" parent="Widget.AppCompat.ProgressBar.Horizontal">
<item name="colorAccent">#000</item>
</style>
Run Code Online (Sandbox Code Playgroud)
我找到了一些关于如何以编程方式或通过添加一些来更改颜色的有用文章layer-list,但我想要简单的解决方案。我想我的实施方式应该有效。
我怎样才能改变颜色?
android ×10
progress-bar ×3
styles ×2
android-4.0-ice-cream-sandwich ×1
geometry ×1
overriding ×1
progress ×1
textview ×1