小编Pro*_*nto的帖子

如何在Android ScrollView上禁用和启用滚动?

我是一个Android开发人员.我也想使用ScrollView.This ScrollView需要一段时间禁用滚动和一些时间启用滚动.但我无法禁用滚动.如何实现它.请帮助我.我也尝试使用一些代码,如

fullparentscrolling.setHorizontalFadingEdgeEnabled(false);
fullparentscrolling.setVerticalFadingEdgeEnabled(false);
Run Code Online (Sandbox Code Playgroud)

要么

 fullparentscrolling.setEnabled(false);
Run Code Online (Sandbox Code Playgroud)

但它不起作用.

java android scrollview

23
推荐指数
3
解决办法
6万
查看次数

更新列表视图中的进度条以下载多个文件

我们如何更新ListView中的进度条.当每个进度条与文件下载相关联时,通过AsyncTask完成.

该功能将是:

  1. 每个进度条都将通过下载过程进行更新.
  2. 当文件完成下载后,它将保存到SD卡中.
  3. 它将添加它服务(在后台运行.
  4. 下载一个文件时,应显示"完成"(不应删除表单列表视图)

我还使用数据库下载文件.该列表还取决于数据库向量.我该如何实现它.我也试过但没有得到解决方案.

以下是详细描述它的两个屏幕截图:

在此输入图像描述

我也试过这段代码:

temp = databaseHandler.getAllNotifyNumber();
list_download = (ListView) findViewById(R.id.list_download);
myCustomAdapter = new MyCustomAdapter(mContext);
list_download.setAdapter(myCustomAdapter);
myCustomAdapter.notifyDataSetChanged();

for (int index = 0; index < temp.size(); index++) {
    String url = "http://upload.wikimedia.org/wikipedia/commons/0/05/Sna_large.png";
    grabURL(url);
}
Run Code Online (Sandbox Code Playgroud)

这是AsyncTask mathod:

  public void grabURL(String url) {
    new GrabURL().execute(url);
}

private class GrabURL extends AsyncTask<String, Integer, String> {

    protected String doInBackground(String... urls) {

        String filename = "MySampleFile.png";
        File myFile = new File(directory, filename);

        try {
            URL url = new URL(urls[0]);
            URLConnection connection …
Run Code Online (Sandbox Code Playgroud)

android download android-listview android-progressbar android-asynctask

11
推荐指数
1
解决办法
4357
查看次数

文件下载 - 负文件长度

我想从我的服务器下载文件(mp3).

我想显示下载进度,但我遇到的问题是整个文件大小-1.

截图: 在此输入图像描述
我的代码:

try {
    URL url = new URL(urls[0]);
    // URLConnection connection = url.openConnection();
    HttpURLConnection connection = (HttpURLConnection) url.openConnection();
    connection.setRequestMethod("GET");
    connection.setDoOutput(true);
    connection.connect();
    int fileSize = connection.getContentLength();
    if (fileSize == -1)
        fileSize = connection.getHeaderFieldInt("Length", -1);
    InputStream is = new BufferedInputStream(url.openStream());
    OutputStream os = new FileOutputStream(myFile);

    byte data[] = new byte[1024];
    long total = 0;
    int count;
    while ((count = is.read(data)) != -1) {
        total += count;
        Log.d("fileSize", "Lenght of file: " + fileSize);
        Log.d("total", "Lenght of file: …
Run Code Online (Sandbox Code Playgroud)

java android

6
推荐指数
1
解决办法
652
查看次数

Android Marshmallow错误:GoogleService初始化失败,状态:10,缺少预期资源:

我有一个Android应用程序.在这个应用程序中,我通过谷歌GCM实现推送通知.它在Marshmallow下工作得很好.但是当我打开这个应用程序到Marshmallow然后它没有打开应用程序.它显示一个错误消息.

GoogleService初始化失败,状态:10,缺少预期资源:'R.string.google_app_id'用于初始化Google服务.可能的原因是缺少google-services.json或com.google.gms.google-services gradle插件

只有我为Marshmallow得到了这个错误.但是其他版本运行良好.不明白什么是Marshmallow的问题.请给我任何建议如何我可以解决Marshmallow.Thanks All的这个错误.

android push-notification google-cloud-messaging android-6.0-marshmallow

5
推荐指数
0
解决办法
2万
查看次数

How I get the default ringtone list in android on programmatically?

I am android developer and want to create a android apps.In this apps ,it needed to show the android default ringtone list.But i can not show it.How to get the android default ringtone list .

Please help to me.

android ringtone

4
推荐指数
2
解决办法
7148
查看次数