Java – how to create a custom progress bar in the action bar?

It's not an action bar, but a custom progress bar that I need help with. I want to create exactly the same as catch notes – https://ssl.gstatic.com/android/market/com.threebanana.notes/ss-480-0-9 https://market.android.com/details?id=com.threebanana.notes

I've tried many different ways. I've seen many tutorials, including Android dev guide. I'm very angry at this. Will anyone help me?

Now, my action bar is calling the general progress bar layout and working normally

switch (item.getItemId()) {
    case R.id.refresh:
        item.setActionView(R.layout.progress);
        return true;

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent" android:weightSum="1">

<ProgressBar android:id="@+id/progress" 
style="?android:attr/progressBarStyleSmall"  
android:layout_width="wrap_content" 
android:layout_height="wrap_content">
</ProgressBar>

</LinearLayout>

resolvent:

To display the progress bar, you need to open actionbar.display in actionbar.displayoptions_ SHOW_ CUSTOM.

Catch notes uses custom animation for its progress bar. I think the default holo (normal size) is a reasonable choice, but in order to get something similar to their specific, you need to create an animationdrawable

http://developer.android.com/reference/android/graphics/drawable/AnimationDrawable.html

Then use getcustomview () to get the custom view from the actionbar, find your ImageView, and start its animation

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>