導航:首頁 > 操作系統 > android復制文件進度條

android復制文件進度條

發布時間:2022-06-15 00:03:59

1. Mac操作系統專用的android文件傳輸系統

因為幾乎所有的Android設備,包括深受用戶歡迎的Nexus和GalaxyS系列手機,都可以被OSX內置的攝像頭應用程序識別為一個數碼相機;你要做的只是打開相應的應用程序,然後使用USB線將Android設備連接到Mac上。我們說「幾乎所有的Android設備」,是因為一些古怪的設備並不能被識別為數碼相機。如果你手裡恰好有一台這樣的設備,不用著急,我們還有一個應用:「Android文件傳輸」,它可以在你的Android設備不能被正確的識別為數碼相機的時候,依然能夠讓你將照片拷貝到Mac里。下面我們會分別介紹這兩種拷貝文件的方法。長期使用Mac系統的用戶用戶會發現,除兩個應用使用上的微小差異外,從數碼相機中復制照片,就像從其他iOS設備,比如iPhone、iPodtouch或者iPad中拷貝其他文件一樣簡單。使用圖像捕捉從Android設備中復制照片圖像捕捉是從數碼外設中向Mac復制照片的首選。它小巧、快速、使用方便並且提供了縮略圖預覽功能,讓你直接刪除不需要保留的圖片。你不需要繁瑣的步驟就能實現你想要的功能。·使用USB線將Android設備連接都Mac上·啟動「圖像捕捉」應用。如果你不知道在哪裡找到它,去/Applications/下看看·在窗口左側「設備」列表下找到你的Android手機·選擇圖片的在你Mac上的儲存路徑(Mac會自動為你保存圖片,但是如果你有多個數碼設備,強烈建議你選擇一個不同的文件夾用來區分不同的設備)·點擊窗口右下角「全部導入」,這時所有照片會復制到Mac里如果你不想導入全部照片到你的Mac裡面,可以在應用里選中你想導入的圖片,點擊「導入」(而不是「全部導入」)就可以了。有一些Android設備並不很好的與圖像捕捉配合。如果你恰好遇到了這種設備,可以使用Google出品的Android文件傳輸應用來復制文件使用Android文件傳輸應用來復制照片到Mac如果前面提到的復制文件「第一選擇」在你的Android設備上恰好不能工作,你可以試試「第二選擇」:Android文件傳輸。它是一個可以在Android設備和Mac之間互相傳輸文件的應用。「文件傳輸」意味著可以傳輸任何文件,不僅僅局限與照片。這個應用幾乎支持了所有運行Android3.0及更新操作系統的設備。·從Android.com下載並安裝Android文件傳輸(下載後直接放到/Applications/目錄下)·使用USB數據線將Android設備連到Mac上·運行Android文件傳輸,它會自動識別你的設備·一般來說,照片會存儲在「DCIM」、「Pictures」目錄下,兩個目錄都有可能·現在可以像管理Mac本地文件一樣來操作這些照片了:使用滑鼠拖拽照片,就可以復制到你的Mac里當你使用Android文件傳輸向Mac內拷貝文件的時候,在窗口底部會出現進度條、預計剩餘時間、圖片數量和一個取消文件操作的按鈕。在前面提到的兩個的文件夾中,「DCIM」一般用於存儲攝像頭拍攝的照片,而「Pictures」一般用於一些應用儲存圖片。當然,並不是所有的設備都會按照這種方式存儲,所以需要把兩個文件夾下的圖片都復制一次。如果你是一個有Android平板或者手機的Mac用戶,那Android文件傳輸應該是你Mac中一個必備軟體。使用它可以方便、快捷地瀏覽Android設備中絕大部分文件。有一點需要注意的是,不推薦你直接使用它隨意訪問或者更改Android設備上的文件,尤其是電子郵件、日歷、筆記:這樣做會損壞你的文件。推薦使用同步軟體在MacOSX和Android設備之間同步這些數據。使用iPhoto有的Mac用戶會推薦iPhoto:連接設備到Mac上,打開iPhoto,它會將Android設備識別為一個數碼相機、自動搜索設備內的圖片並提供了一個「全部導入」的功能。其實iPhoto的主要功能是管理照片而不是傳輸照片,所以我們不具體介紹它的使用方式了。你如果對此感興趣,可以自行Google它的使用方式並與我們交流使用感受。使用預覽預覽是OSX內默認的圖片查看應用,也可以作為從各種Android設備中拷貝照片到Mac的工具。·把Android設備連接到Mac上·點擊「文件」菜單,然後選擇「從(你的設備名稱)導入」·選中你想要導入的照片,然後點擊「導入」

2. 我用安卓手機下了gtasa,安裝包也復制到odd文件夾里了,為什麼一進去就是一個進度條

有進度條是因為sa沒有檢測到數據包,應該是路徑錯了,正確路徑應該是:根目錄/storage/sdcard1/Andorid/obb,如果路徑正確,那應該就是數據包損壞了。

3. Android開發怎麼自定義繪制如下圖中這種進度條急需!在線等!

一)變換前背景

先來看看progressbar的屬性:
1. <ProgressBar
2. android:id="@+id/progressBar"
3. style="?android:attr/progressBarStyleHorizontal"
4. android:layout_width="match_parent"
5. android:layout_height="wrap_content"
6. android:layout_margin="5dip"
7. android:layout_toRightOf="@+id/progressBarV"
8. android:indeterminate="false"
9. android:padding="2dip"
10. android:progress="50" />
根據style="?android:attr/progressBarStyleHorizontal",我們找到源碼中的style.xml
1. <style name="Widget.ProgressBar.Horizontal">
2. <item name="android:indeterminateOnly">false</item>
3. <item name="android:progressDrawable">@android:drawable/progress_horizontal</item>
4. <item name="android:indeterminateDrawable">@android:drawable/progress_indeterminate_horizontal</item>
5. <item name="android:minHeight">20dip</item>
6. <item name="android:maxHeight">20dip</item>
7. </style>
看到
<item name="android:progressDrawable">@android:drawable/progress_horizontal</item>
木有,繼續發掘源碼,找到drawable下面的progress_horizontal.xml,這就是我們今天的主角了:
1. <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
2.
3. <item android:id="@android:id/background">
4. <shape>
5. <corners android:radius="5dip" />
6. <gradient
7. android:startColor="#ff9d9e9d"
8. android:centerColor="#ff5a5d5a"
9. android:centerY="0.75"
10. android:endColor="#ff747674"
11. android:angle="270"
12. />
13. </shape>
14. </item>
15.
16. <item android:id="@android:id/secondaryProgress">
17. <clip>
18. <shape>
19. <corners android:radius="5dip" />
20. <gradient
21. android:startColor="#80ffd300"
22. android:centerColor="#80ffb600"
23. android:centerY="0.75"
24. android:endColor="#a0ffcb00"
25. android:angle="270"
26. />
27. </shape>
28. </clip>
29. </item>
30.
31. <item android:id="@android:id/progress">
32. <clip>
33. <shape>
34. <corners android:radius="5dip" />
35. <gradient
36. android:startColor="#ffffd300"
37. android:centerColor="#ffffb600"
38. android:centerY="0.75"
39. android:endColor="#ffffcb00"
40. android:angle="270"
41. />
42. </shape>
43. </clip>
44. </item>
45.
46. </layer-list>
看到android:id="@android:id/progress"木有,看到android:id="@android:id/secondaryProgress"木有
把這個文件復制到自己工程下的drawable,就可以隨心所欲的修改shape的屬性,漸變,圓角等等
那麼怎麼放一個圖片進去呢,ok,新建progress_horizontal1.xml:
1. <?xml version="1.0" encoding="utf-8"?>
2. <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
3.
4. <item android:id="@android:id/progress" android:drawable="@drawable/progressbar" />
5.
6. </layer-list>
在android:drawable中指定你處理好的圖片
然後回到布局中
1. <ProgressBar
2. android:id="@+id/progressBar1"
3. android:layout_width="match_parent"
4. android:layout_height="wrap_content"
5. android:layout_below="@+id/progressBar"
6. android:layout_margin="5dip"
7. android:layout_toRightOf="@+id/progressBarV"
8. android:background="@drawable/progress_bg"
9. android:indeterminate="false"
10. android:indeterminateOnly="false"
11. android:maxHeight="20dip"
12. android:minHeight="20dip"
13. android:padding="2dip"
14. android:progress="50"
15. android:progressDrawable="@drawable/progress_horizontal1" />
android:background="@drawable/progress_bg"指定背景
android:progressDrawable="@drawable/progress_horizontal1"前景使用上面的progress_horizontal1

要是還不行

你來我們群里說吧

這里是開發者互相學習交流的 有大神

讓他們給你解釋你的疑問 號 碼look at my n a m e.....

4. 復制文件的進度條一直不動,求解決

win7系統不是很好用,建議你還是用xp,我就用的xp3大白菜挺不錯的
WIN 7 系統 就那一個文件(MP4格式,大小不到100M),嘗試往好多地方復制(本電腦的其他分區、移動硬碟、U盤),走到一半就不走了,點取消也半天沒有辦法取消,跟著就是電腦非常的卡,以至於直接關電源處理。
但是那個文件打開什麼的都沒有什麼大問題,也可以刪除。
已經好多次遇到同樣的問題了,麻煩大家看一下是什麼原因。

5. android關於進度條的問題,急求

安裝應用程序使用的進度條,都是「不確定」的,即屬性「android:indeterminateOnly=true」。因為具體的安裝是由PackageManagerService來完成的,無法確定的知道安裝進度。
-----------------------------------------------------------------------------------------------------
安卓精英團為你解答
安卓精英團歡迎各位精英加入!

6. android 繪制進度條

看起來代碼挺長,其實都是在獲取自定義屬性,沒什麼技術含量。
寬度不變,所以的自定義屬性不涉及寬度,高度呢,只考慮不是EXACTLY的情況(用戶明確指定了,就不管了),根據padding和進度條寬度算出自己想要的,如果非EXACTLY下,進行exceptHeight封裝,傳入給控制項進行測量高度。

橫向的滾動條繪制肯定需要一些屬性,比如已/未到達進度的顏色、寬度,文本的顏色、大小等。
本來呢,我是想通過系統ProgressBar的progressDrawable,從裡面提取一些屬性完成繪制需要的參數的。但是,最終呢,反而讓代碼變得復雜。所以最終還是改用自定義屬性。 說道自定義屬性,大家應該已經不陌生了。

1、
1、自定義屬性
values/attr_progress_bar.xml:

[html] view plain
<?xml version="1.0" encoding="utf-8"?>
<resources>

<declare-styleable name="">
<attr name="progress_unreached_color" format="color" />
<attr name="progress_reached_color" format="color" />
<attr name="progress_reached_bar_height" format="dimension" />
<attr name="progress_unreached_bar_height" format="dimension" />
<attr name="progress_text_size" format="dimension" />
<attr name="progress_text_color" format="color" />
<attr name="progress_text_offset" format="dimension" />
<attr name="progress_text_visibility" format="enum">
<enum name="visible" value="0" />
<enum name="invisible" value="1" />
</attr>
</declare-styleable>

<declare-styleable name="RoundProgressBarWidthNumber">
<attr name="radius" format="dimension" />
</declare-styleable>

</resources>
2、構造中獲取

[java] view plain
public class extends ProgressBar
{

private static final int DEFAULT_TEXT_SIZE = 10;
private static final int DEFAULT_TEXT_COLOR = 0XFFFC00D1;
private static final int DEFAULT_COLOR_UNREACHED_COLOR = 0xFFd3d6da;
private static final int DEFAULT_HEIGHT_REACHED_PROGRESS_BAR = 2;
private static final int DEFAULT_HEIGHT_UNREACHED_PROGRESS_BAR = 2;
private static final int DEFAULT_SIZE_TEXT_OFFSET = 10;

/**
* painter of all drawing things
*/
protected Paint mPaint = new Paint();
/**
* color of progress number
*/
protected int mTextColor = DEFAULT_TEXT_COLOR;
/**
* size of text (sp)
*/
protected int mTextSize = sp2px(DEFAULT_TEXT_SIZE);

/**
* offset of draw progress
*/
protected int mTextOffset = dp2px(DEFAULT_SIZE_TEXT_OFFSET);

/**
* height of reached progress bar
*/
protected int mReachedProgressBarHeight = dp2px(DEFAULT_HEIGHT_REACHED_PROGRESS_BAR);

/**
* color of reached bar
*/
protected int mReachedBarColor = DEFAULT_TEXT_COLOR;
/**
* color of unreached bar
*/
protected int mUnReachedBarColor = DEFAULT_COLOR_UNREACHED_COLOR;
/**
* height of unreached progress bar
*/
protected int mUnReachedProgressBarHeight = dp2px(DEFAULT_HEIGHT_UNREACHED_PROGRESS_BAR);
/**
* view width except padding
*/
protected int mRealWidth;

protected boolean mIfDrawText = true;

protected static final int VISIBLE = 0;

public (Context context, AttributeSet attrs)
{
this(context, attrs, 0);
}

public (Context context, AttributeSet attrs,
int defStyle)
{
super(context, attrs, defStyle);

setHorizontalScrollBarEnabled(true);

obtainStyledAttributes(attrs);

mPaint.setTextSize(mTextSize);
mPaint.setColor(mTextColor);

}

/**
* get the styled attributes
*
* @param attrs
*/
private void obtainStyledAttributes(AttributeSet attrs)
{
// init values from custom attributes
final TypedArray attributes = getContext().obtainStyledAttributes(
attrs, R.styleable.);

mTextColor = attributes
.getColor(
R.styleable._progress_text_color,
DEFAULT_TEXT_COLOR);
mTextSize = (int) attributes.getDimension(
R.styleable._progress_text_size,
mTextSize);

mReachedBarColor = attributes
.getColor(
R.styleable._progress_reached_color,
mTextColor);
mUnReachedBarColor = attributes
.getColor(
R.styleable._progress_unreached_color,
DEFAULT_COLOR_UNREACHED_COLOR);
mReachedProgressBarHeight = (int) attributes
.getDimension(
R.styleable._progress_reached_bar_height,
mReachedProgressBarHeight);
mUnReachedProgressBarHeight = (int) attributes
.getDimension(
R.styleable._progress_unreached_bar_height,
mUnReachedProgressBarHeight);
mTextOffset = (int) attributes
.getDimension(
R.styleable._progress_text_offset,
mTextOffset);

int textVisible = attributes
.getInt(R.styleable._progress_text_visibility,
VISIBLE);
if (textVisible != VISIBLE)
{
mIfDrawText = false;
}
attributes.recycle();
}

3、onMeasure
剛才不是出onDraw裡面寫寫就行了么,為什麼要改onMeasure呢,主要是因為我們所有的屬性比如進度條寬度讓用戶自定義了,所以我們的測量也得稍微變下。

[java] view plain
@Override
protected synchronized void onMeasure(int widthMeasureSpec,
int heightMeasureSpec)
{
int heightMode = MeasureSpec.getMode(heightMeasureSpec);

if (heightMode != MeasureSpec.EXACTLY)
{

float textHeight = (mPaint.descent() + mPaint.ascent());
int exceptHeight = (int) (getPaddingTop() + getPaddingBottom() + Math
.max(Math.max(mReachedProgressBarHeight,
mUnReachedProgressBarHeight), Math.abs(textHeight)));

heightMeasureSpec = MeasureSpec.makeMeasureSpec(exceptHeight,
MeasureSpec.EXACTLY);
}
super.onMeasure(widthMeasureSpec, heightMeasureSpec);

}

測量完,就到我們的onDraw了~~~

7. 如何實現在Android文件上傳進度條

實現在android實現帶進度條的上傳效果效果如圖: 用到以下兩個類就可實現帶進度條的文件上傳: 1、CustomMultiPartEntity extends MultipartEntity, 2、HttpMultipartPost extends AsyncTask 代碼如下: import java/UploadImage.php"); try{ = newCustomMultipartEntity( newProgressListener() { @Override public void transferred(longnum){ publishProgress((int) ((num / (float) totalSize) * 100)); } }); // We use FileBody to transfer an image multipartContent.addPart("uploaded_file", newFileBody( newFile(m_userSelectedImagePath))); totalSize= multipartContent.getContentLength(); // Send it httpPost.setEntity(multipartContent); HttpResponseresponse = httpClient.execute(httpPost, httpContext); String serverResponse = EntityUtils.toString(response.getEntity()); ResponseFactoryrp = newResponseFactory(serverResponse); return(TypeImage) rp.getData(); } catch(Exception e) { System.out.println(e); } returnnull; } @Override protectedvoidonProgressUpdate(Integer... progress){ pd.setProgress((int) (progress[0])); } @Override protectedvoidonPostExecute(TypeUploadImageui) { pd.dismiss(); } } 在 transferred()函數中調用publishProgress((int) ((num / (float) totalSize) * 100)); 在onProgressUpdate()實現上傳進度的更新操作

8. android開發中videoview的自帶的進度條如何隱藏

android自帶的播放器的進度條是默認會自動隱藏的,不能設置的。除非你去改源代碼。你可以下個其他的播放器,看看能不能設置為不自動隱藏。

MediaController mc = new MediaController(this);

mc.setVisibility(View.INVISIBLE);

videoView.setMediaController(mc);

我是實現了,可以把VideoView自帶的進度條隱藏。

用MediaController應該可以實現

如果用的VideoView的話,用如下代碼:

MediaController mc = new MediaController(this);

mc.setVisibility(View.VISIBLE);

vvView.setMediaController(mc);

(8)android復制文件進度條擴展閱讀:

以文件處理為例

單個文件的進度處理方法:

使用CopyFileEx進行文件復制,這個函數專門提供了一個回調函數用來處理你的進度條,詳細參見MSDN。

總體進度的處理方法:

如果一批文件,首先獲得文件的數量count = 文件數量

設置進條的范圍為0至count,每完成一個文件,就向前進一步。

9. 怎樣實現在android實現帶進度條的上傳效果

實現在android實現帶進度條的上傳效果效果如圖:


用到以下兩個類就可實現帶進度條的文件上傳:


1、CustomMultiPartEntity extends MultipartEntity,


2、HttpMultipartPost extends AsyncTask


代碼如下:


import java.io.FilterOutputStream;


import java.io.IOException;


import java.io.OutputStream;


import java.nio.charset.Charset;


import org.apache.http.entity.mime.HttpMultipartMode;


import org.apache.http.entity.mime.MultipartEntity;



public class CustomMultipartEntity extends MultipartEntity {


private final ProgressListener listener;


public CustomMultipartEntity(final ProgressListener listener) {


super();


this.listener = listener;


}


public CustomMultipartEntity(final HttpMultipartMode mode, final ProgressListener listener) {


super(mode);


this.listener = listener;


}


public CustomMultipartEntity(HttpMultipartMode mode, final String boundary,


final Charset charset, final ProgressListener listener) {


super(mode, boundary, charset);


this.listener = listener;


}


@Override


public void writeTo(final OutputStream outstream) throws IOException {


super.writeTo(new CountingOutputStream(outstream, this.listener));


}


public static interface ProgressListener {


void transferred(long num);


}



public static class CountingOutputStream extends FilterOutputStream {


private final ProgressListener listener;


private long transferred;


public CountingOutputStream(final OutputStream out, final ProgressListener listener) {


super(out);


this.listener = listener;


this.transferred = 0;


}


public void write(byte[] b, int off, int len) throws IOException {


out.write(b, off, len);


this.transferred += len;


this.listener.transferred(this.transferred);


}


public void write(int b) throws IOException {


out.write(b);


this.transferred++;


this.listener.transferred(this.transferred);


}


}


}


該類計算寫入的位元組數,我們需要在實現ProgressListener中的trasnfered()方法,更行進度條



public class HttpMultipartPost extends AsyncTask<HttpResponse, Integer, TypeUploadImage> {



ProgressDialogpd;



longtotalSize;



@Override


protectedvoidonPreExecute(){


pd= newProgressDialog(this);


pd.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);


pd.setMessage("Uploading Picture...");


pd.setCancelable(false);


pd.show();


}



@Override


(HttpResponse... arg0) {


HttpClienthttpClient = newDefaultHttpClient();


HttpContexthttpContext = newBasicHttpContext();


HttpPosthttpPost = newHttpPost("http://herpderp.com/UploadImage.php");



try{


= newCustomMultipartEntity(


newProgressListener() {



@Override


public void transferred(longnum){


publishProgress((int) ((num / (float) totalSize) * 100));


}


});



// We use FileBody to transfer an image


multipartContent.addPart("uploaded_file", newFileBody(


newFile(m_userSelectedImagePath)));


totalSize= multipartContent.getContentLength();



// Send it


httpPost.setEntity(multipartContent);


HttpResponseresponse = httpClient.execute(httpPost, httpContext);


String serverResponse = EntityUtils.toString(response.getEntity());



ResponseFactoryrp = newResponseFactory(serverResponse);


return(TypeImage) rp.getData();


}



catch(Exception e) {


System.out.println(e);


}


returnnull;


}



@Override


protectedvoidonProgressUpdate(Integer... progress){


pd.setProgress((int) (progress[0]));


}



@Override


protectedvoidonPostExecute(TypeUploadImageui) {


pd.dismiss();


}


}

在 transferred()函數中調用publishProgress((int) ((num / (float) totalSize) * 100));


在onProgressUpdate()實現上傳進度的更新操作

10. android文件的復制

方法如下:
1、先執行
mount
-o
remount
/system
(應該是這樣,重新掛在分區
,獲取許可權寫入)
2、然後就開始復制了,如果已經把raw里的文件寫到sd卡上了,那就執行命令
cp
/sdcard/***.apk
/system/app
(***.apk就是你要
的文件名);
3、如果沒寫到卡上,那就直接用文件流,直接寫到/system/app下就行了。
4、復制過去後,修改下許可權,命令為
chmod
755
/system/app/***.apk

閱讀全文

與android復制文件進度條相關的資料

熱點內容
柯潔在哪個app下圍棋 瀏覽:749
平板用什麼app看內在美 瀏覽:607
cad計算機命令 瀏覽:173
郵箱設置域名伺服器錯誤什麼意思 瀏覽:671
硬碟解壓失敗受損藍屏 瀏覽:654
應用和伺服器是什麼意思 瀏覽:485
程序員需要知道的網站 瀏覽:713
微信支付頁面加密碼怎麼加 瀏覽:57
網路加密狗問題 瀏覽:698
cnc曲面編程實例 瀏覽:170
什麼app零粉分發視頻有收益 瀏覽:164
肯亞程序員 瀏覽:640
新科源碼 瀏覽:661
如何判斷伺服器有沒有帶寬 瀏覽:44
天正建築批量刪除命令 瀏覽:96
cad最下面的一排命令都什麼意思 瀏覽:456
pythonimportcpp 瀏覽:852
W10的系統怎麼給U盤加密 瀏覽:372
華為手機代碼編程教學入門 瀏覽:764
和彩雲沒會員怎樣解壓 瀏覽:636