我得到了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