我得到了ABS不确定的进度出现,但它出现在操作栏上方。这与ABS Progress演示行为一致,但这不是我想要的。 我想要Gmail的行为。ActionBarSherlock不确定的进度条显示在操作栏上
这里是我的截图和ABS演示进度的截图,以及我的代码:
package com.demo.uiproofer; import java.util.concurrent.atomic.AtomicBoolean; import com.actionbarsherlock.app.SherlockActivity; import com.actionbarsherlock.view.Menu; import com.actionbarsherlock.view.MenuItem; import android.os.Bundle; import android.util.Log; public class MainActivity extends SherlockActivity{ private static String TAG = "MainActivity"; private AtomicBoolean isRefreshing; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature((long)com.actionbarsherlock.view.Window.FEATURE_PROGRESS); setContentView(R.layout.activity_main); getSherlock(); getSupportActionBar(); //setSupportProgressBarIndeterminateVisibility(false); if (isRefreshing==null) { isRefreshing = new AtomicBoolean(false); } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getSupportMenuInflater().inflate(R.menu.main, menu); setSupportProgressBarVisibility(true); setSupportProgressBarIndeterminateVisibility(false); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { setSupportProgressBarIndeterminate(true); if (isRefreshing.get()==false) { Log.i(TAG, "On Start Refresh Click!"); getSherlock(); getSupportActionBar(); setSupportProgressBarVisibility(true); //setSupportProgressBarIndeterminateVisibility(true); } else { Log.i(TAG, "On Stop Refresh Click!"); getSherlock(); getSupportActionBar(); setSupportProgressBarVisibility(false); //setSupportProgressBarIndeterminateVisibility(false); } isRefreshing.set(!isRefreshing.get()); return true; } return super.onOptionsItemSelected(item); } }
我要的是Gmail的行为不确定的进度条,没有拉回来新鲜当然:
请检查我的回答帖子this.https://stackoverflow.com/questions/13934010/progressbar-under-action-bar/23609484#23609484 – Rank