我用的是一个ProgressBar在xml的Android总线上很慢.最佳是60fps.是否可以更改帧速率或添加更多fps的自定义进度圈?
<ProgressBar
android:id="@+id/progressBar1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="17dp"
android:layout_gravity="center" />
Run Code Online (Sandbox Code Playgroud) 在我的 android 应用程序中,我有几个小部件,我希望它们看起来像这些进度条。
现在我知道我不能使用任何外部库来做到这一点,因为小部件不支持大多数自定义视图。我见过大多数开发人员使用位图来绘制这样的东西。我可以设法画一个完整的圆圈。但是如何使用位图绘制这个弧形进度条或者还有其他方法吗?
感谢你的帮助。谢谢!
但两者都给出了解决方案,例如更改海拔或平移。
问题是关于在不支持海拔或平移属性的旧版本中将进度栏放在按钮前面。
我怎样才能在 XML 和 Java 中做到这一点?
或者它是无效的。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.business.abdelhafiz.omar.civiltaif.LoginActivity">
<ImageView
android:src="@drawable/home_civil"
android:scaleType="fitXY"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<ProgressBar
android:id="@+id/login_progressbar"
android:layout_centerInParent="true"
android:layout_width="@dimen/image_height"
android:layout_height="@dimen/image_height" />
<Button
android:id="@+id/login_email"
android:layout_centerInParent="true"
android:text="@string/login_email"
android:onClick="loginEmail"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<Button
android:id="@+id/login_anonymous"
android:layout_centerInParent="true"
android:layout_below="@id/login_email"
android:text="@string/login_anonymous"
android:onClick="loginAnonymous"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
这是一个屏幕截图
我想将进度条放在按钮前面
编辑:
没有什么对我有用,所以当我需要显示进度栏时,我只会隐藏按钮。
感谢您的帮助。
我想将用户的声音注册为 3 次输入。为此,我想创建一个 UI(XML文件),当第一次录制完成时,它会通过从第 1 步移动到第 2 步来制作动画,这将由开始停止按钮控制。并最终进入第 3 步..... 像这样 -
我不知道如何向谷歌解释这个!请帮忙!!
在我的项目中我想使用ProgressBar并且我想设置平滑倒计时动画。
我下面写的代码顺利动画,当一套1000毫秒(1秒)的时间演出顺利 animation,但我想要一套10000ms(10秒)的时间。
当持续时间设置为 10000 毫秒(10 秒)时,动画不流畅并显示片段倒计时。
但我想一套10000ms的时间,并显示顺利倒计时。
public class SimpleFrag extends Fragment {
TextView toolbar_title;
RelativeLayout toolbar;
private ProgressBar progressBar;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_simple, container, false);
ButterKnife.bind(this, view);
toolbar_title = getActivity().findViewById(R.id.toolbar_title);
toolbar = getActivity().findViewById(R.id.toolbar);
progressBar = view.findViewById(R.id.progress);
return view;
} …Run Code Online (Sandbox Code Playgroud) 我正在为我的应用程序AppBarLayout添加进度条:
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="?attr/appBarLayoutTheme">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="?attr/toolbarPopupTheme"/>
<ProgressBar
style="?android:progressBarStyleHorizontal"
android:id="@+id/progress_loader"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="-8dp"
android:indeterminateTint="@color/greyishWhite"
android:layout_marginTop="-9dp"
android:maxWidth="2000dp"
android:indeterminateOnly="true"/>
</android.support.design.widget.AppBarLayout>
Run Code Online (Sandbox Code Playgroud)
在纵向模式下一切看起来都很好:
但在横向模式下,它不需要完整的父宽度:
我怎样才能强制ProgressBar随时使用.
回答:
感谢@Mahavir Jain指导正确的道路:
最后,所有需要做的就是改变
android:indeterminateOnly="true"
Run Code Online (Sandbox Code Playgroud)
至
android:indeterminate="true"
Run Code Online (Sandbox Code Playgroud) 使用Material Design 库中的TextInputLayout,我们可以使用各种结束图标模式进行密码编辑、文本清除和自定义模式。此外,如果我们使用任何样式,它将自动应用显示打开和关闭 V 形的特殊结束图标模式。Widget.MaterialComponents.TextInputLayout.*.ExposedDropdownMenu
各种图标模式示例:
鉴于结束图标的各种用例,我们决定在 中使用加载指示器InputTextLayout,使其看起来像这样:
应该如何着手实施呢?
android loading android-progressbar progress-bar material-components-android
我想实现一个类似于这样的进度条:
在材料的设计文档,它说我需要设置indeterminateAnimationType来contiguous实现这一目标,并提供三种颜色。但是当indicatorColor属性只接受一种颜色时如何提供三种颜色?
当我运行这段代码时,它抛出一个异常说Contiguous indeterminate animation must be used with 3 or more indicator colors:
<com.google.android.material.progressindicator.LinearProgressIndicator
android:id="@+id/progress"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:indeterminate="true"
app:indeterminateAnimationType="contiguous"
app:hideAnimationBehavior="outward"
app:showAnimationBehavior="inward"
app:trackThickness="5dp" />
Run Code Online (Sandbox Code Playgroud) xml android android-progressbar material-design material-components-android
在我的Android应用程序中,我将一些数据从服务器数据库复制到本地数据库.代码发布在下面.可能需要15分钟.对于较慢的连接,可能会超出.所以我想显示一个等待进度条,它应显示"请等待",直到任务完成.我引用了很多东西,但我无法理解如何使用以下代码中的等待进度条.
refresh.setOnClickListener(new OnClickListener(){
public void onClick(View v) {
mySQLiteAdapter.openToWrite();
mySQLiteAdapter.deleteAll();
radapter.openToWrite();
radapter.deleteAll();
uadapter.openToWrite();
uadapter.deleteAll();
try
{
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://xxxxxxxxxxxxxxxxxxxxx");
HttpResponse response = httpclient.execute(httppost);
HttpEntity entity = response.getEntity();
is = entity.getContent();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(
is, "iso-8859-1"), 8);
StringBuilder sb = new StringBuilder();
String line = null;
while ((line = reader.readLine()) …Run Code Online (Sandbox Code Playgroud) 我想创建一个类似于gmail应用的进度条(中间进度条),它会更改颜色。我可以通过从sdk / platforms保留并更新progress_indeterminate_horizontal.xml来实现此目的。我不想使用动画(多色图像)。我想使用xml来实现这一点(我想使用渐变)。任何帮助将不胜感激。
提前致谢
android ×10
material-components-android ×2
progress-bar ×2
xml ×2
android-ui ×1
animation ×1
gmail ×1
java ×1
loading ×1