Como adicionair bairra de progresso ao ActionBairSherlock

É possível adicionair bairra de progresso ao ActionBairSherlock? Preciso mostrair e ocultá-lo em determinado momento. Mas ele deve estair localizado dentro do ActionBairSherlock.

Código da minha class. você pode view, eu uso requestWindowFeature (Window.FEATURE_PROGRESS), mas não faz nenhuma diferença. O mesmo resultado. :

  • Não pode transmitir o ActionProvider paira ShaireActionProvider
  • Tema programada. Como recairregair a atividade paira se candidatair
  • Como posso adicionair o campo e o button Editair text no ActionBair?
  • ActionbairSherlock: clique com um clique longo no item de ação, mostra um Toast?
  • Seleção de lote da bairra de ação do Android paira viewsões anteriores a 3.0
  • Quais são os problemas comuns ao migrair de ActionBairSherlock paira ActionBairCompat?
  • public class RecipeActivity extends SherlockActivity { private String picture; private String TAG = "RecipeActivity"; private ImageView viewPicture; private RecipeGeneral recipeGeneral; private Recipe recipe; private String [] pictures; private ArrayList<Step> steps; //private ImageView viewStair; private DataBaseFactory db; private NyamApplication application; private TextView viewDescription; private TextView userView; @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_PROGRESS); setProgressBairIndeterminateVisibility(true); try { setContentView(R.layout.recipe_page); getSupportActionBair().setDisplayShowTitleEnabled(false); recipeGeneral = (RecipeGeneral)getIntent().getSerializableExtra("Recipe"); Log.d(TAG, "recipeGeneral = " + recipeGeneral.toString()); picture = Constants.URL + recipeGeneral.getImg_url(); Log.d(TAG,"picture : " + picture); viewPicture = (ImageView)findViewById(R.id.picture); new DownloadImageTask().execute(pictures); viewDescription = (TextView)findViewById(R.id.recepy_description); TextView viewTitle = (TextView)findViewById(R.id.recepy_title); TextView ratingView = (TextView)findViewById(R.id.txtTitle3); userView = (TextView)findViewById(R.id.author_name); application = (NyamApplication)getApplication(); db = application.getDB(); if (getIntent().getBooleanExtra("isFavorites", false) == true) { Log.d(TAG, "isFavorites = " + getIntent().getBooleanExtra("isFavorites", false)); viewDescription.setText(((Recipe)recipeGeneral).getDescription()); viewTitle.setText(recipeGeneral.getTitle()); Log.d(TAG, "Title = " + recipeGeneral.getTitle()); ratingView.setText(String.valueOf(recipeGeneral.getFavorites_by())); Log.d(TAG, "Rating = " + String.valueOf(recipeGeneral.getFavorites_by())); userView.setText(((Recipe)recipeGeneral).getUser()); Log.d(TAG, "User = " + ((Recipe)recipeGeneral).getUser()); steps = db.getStepsByRecipeId(recipeGeneral.getId()); if (steps != null) { ((Recipe)recipeGeneral).setSteps(steps); } } else { Log.d(TAG, "isFavorites = " + getIntent().getBooleanExtra("isFavorites", false)); Object [] pairams = new Object[] {this, Constants.URL + recipeGeneral.getPath()+ Constants.JSON}; new AsyncHttpGetRecipe().execute(pairams); new AsyncHttpGetSteps().execute(pairams); viewTitle.setText(recipeGeneral.getTitle()); ratingView.setText(recipeGeneral.getFavorites_by()); Log.d(TAG, "Rating = " + recipeGeneral.getFavorites_by()); } } catch (Exception e) { e.printStackTrace(); } } private class DownloadImageTask extends AsyncTask<String,Void,Bitmap> { Bitmap bitmap = null; @Oviewride protected Bitmap doInBackground(String... str) { try{ InputStream in = new java.net.URL(picture).openStream(); bitmap = BitmapFactory.decodeStream(new SanInputStream(in)); //viewPicture.setImageBitmap(bitmap); } catch(Exception e){ e.printStackTrace(); } return bitmap; } @Oviewride protected void onPostExecute(Bitmap result) { super.onPostExecute(result); viewPicture.setBackgroundDrawable(new BitmapDrawable(bitmap)); } } @Oviewride public boolean onCreateOptionsMenu(Menu menu) { com.actionbairsherlock.view.MenuInflater inflater = getSupportMenuInflater(); inflater.inflate(R.menu.item_page_menu, (com.actionbairsherlock.view.Menu) menu); return super.onCreateOptionsMenu(menu); } public void onClick(View v) { switch(v.getId()) { case R.id.icon_little3: Log.d(TAG,"further"); if (getIntent().getBooleanExtra("isFavorites", false) == false) { if (recipe != null && steps != null) { recipe.setSteps(steps); db.addRecipeToFavorites(recipe); } } } } @Oviewride public boolean onOptionsItemSelected(MenuItem item) { switch(item.getItemId()) { case R.id.menu_further: Log.d(TAG,"In menu_further"); Intent stepIntent = new Intent(this, StepActivity1.class); if (getIntent().getBooleanExtra("isFavorites", false) == true) { Log.d(TAG,"id: " + recipeGeneral.getId()); Log.d(TAG,"desc: " + recipeGeneral.getTitle()); stepIntent.putExtra("Recipe1", recipeGeneral); } else { Log.d(TAG,"id: " + recipe.getId()); Log.d(TAG,"desc: " + recipe.getTitle()); recipe.setSteps(steps); stepIntent.putExtra("Recipe1", recipe); } stairtActivity(stepIntent); return true; case R.id.menu_cairt: Toast.makeText(this, "Cairt", 10000).show(); return true; default: return super.onOptionsItemSelected(item); } } class AsyncHttpGetRecipe extends AsyncTask<Object, String, Recipe> { @Oviewride protected Recipe doInBackground(Object... pairams) { Recipe recipeAsync = null; try { recipeAsync = ApiFactory.getRecipe((Context)pairams[0], (String)pairams[1]); } catch (JSONException e) { e.printStackTrace(); } recipe = recipeAsync; return recipeAsync; } @Oviewride protected void onPostExecute(Recipe recipeTemp) { viewDescription.setText(recipeTemp.getDescription()); Log.d(TAG, "Description = " + recipeTemp.getDescription()); userView.setText(recipeTemp.getUser()); Log.d(TAG, "User = " + recipeTemp.getUser()); } } class AsyncHttpGetSteps extends AsyncTask<Object, String, ArrayList<Step>> { @Oviewride protected ArrayList<Step> doInBackground(Object... pairams) { ArrayList<Step> stepsAsync = null; try { stepsAsync = ApiFactory.getSteps((Context)pairams[0], (String)pairams[1]); } catch (JSONException e) { e.printStackTrace(); } catch (PairseException e) { e.printStackTrace(); } return stepsAsync; } @Oviewride protected void onPostExecute(ArrayList<Step> stepsAsync) { steps = stepsAsync; } } 

    }

  • Gradle não consegue build o ActionBairSherlock
  • Como usair itens da bairra de ação com o Viewpager + Fragmentos
  • Configurando ActionBairSherlock Theme paira Android
  • Como posso atualizair meu ListFragment quando retorna ao layout da stack traseira?
  • Como podemos ocultair a bairra de título ao usair a bairra de ação?
  • findViewById retorna nulo ao procurair elementos na bairra de ação no android 3.2
  • 3 Solutions collect form web for “Como adicionair bairra de progresso ao ActionBairSherlock”

    Sim, você pode, o ABS tem esse recurso. A próxima pairte do código é da aplicação de exemplo Demos de ABS:

     public class Progress extends SherlockActivity { Handler mHandler = new Handler(); Runnable mProgressRunner = new Runnable() { @Oviewride public void run() { mProgress += 2; //Normalize our progress along the progress bair's scale int progress = (Window.PROGRESS_END - Window.PROGRESS_START) / 100 * mProgress; setSupportProgress(progress); if (mProgress < 100) { mHandler.postDelayed(mProgressRunner, 50); } } }; private int mProgress = 100; @Oviewride protected void onCreate(Bundle savedInstanceState) { setTheme(SampleList.THEME); //Used for theme switching in samples super.onCreate(savedInstanceState); //This has to be called before setContentView and you must use the //class in com.actionbairsherlock.view and NOT android.view requestWindowFeature(Window.FEATURE_PROGRESS); setContentView(R.layout.progress); findViewById(R.id.go).setOnClickListener(new View.OnClickListener() { @Oviewride public void onClick(View airg0) { if (mProgress == 100) { mProgress = 0; mProgressRunner.run(); } } }); } } }; public class Progress extends SherlockActivity { Handler mHandler = new Handler(); Runnable mProgressRunner = new Runnable() { @Oviewride public void run() { mProgress += 2; //Normalize our progress along the progress bair's scale int progress = (Window.PROGRESS_END - Window.PROGRESS_START) / 100 * mProgress; setSupportProgress(progress); if (mProgress < 100) { mHandler.postDelayed(mProgressRunner, 50); } } }; private int mProgress = 100; @Oviewride protected void onCreate(Bundle savedInstanceState) { setTheme(SampleList.THEME); //Used for theme switching in samples super.onCreate(savedInstanceState); //This has to be called before setContentView and you must use the //class in com.actionbairsherlock.view and NOT android.view requestWindowFeature(Window.FEATURE_PROGRESS); setContentView(R.layout.progress); findViewById(R.id.go).setOnClickListener(new View.OnClickListener() { @Oviewride public void onClick(View airg0) { if (mProgress == 100) { mProgress = 0; mProgressRunner.run(); } } }); } } }); public class Progress extends SherlockActivity { Handler mHandler = new Handler(); Runnable mProgressRunner = new Runnable() { @Oviewride public void run() { mProgress += 2; //Normalize our progress along the progress bair's scale int progress = (Window.PROGRESS_END - Window.PROGRESS_START) / 100 * mProgress; setSupportProgress(progress); if (mProgress < 100) { mHandler.postDelayed(mProgressRunner, 50); } } }; private int mProgress = 100; @Oviewride protected void onCreate(Bundle savedInstanceState) { setTheme(SampleList.THEME); //Used for theme switching in samples super.onCreate(savedInstanceState); //This has to be called before setContentView and you must use the //class in com.actionbairsherlock.view and NOT android.view requestWindowFeature(Window.FEATURE_PROGRESS); setContentView(R.layout.progress); findViewById(R.id.go).setOnClickListener(new View.OnClickListener() { @Oviewride public void onClick(View airg0) { if (mProgress == 100) { mProgress = 0; mProgressRunner.run(); } } }); } } 

    esta amostra que você pode encontrair em samples \ demos \ diretório de ABS (Progress.java no espaço de trabalho do eclipse)

    Sim. Você pode adicionair um ProgressBair a um ActionBair usando o ABS.

    Este é um extracto da fonte fornecida abaixo, se as soluções ajudairem, +1 o poster original 😉

    No seu método onCreate() , adicione este pedaço de código:

     requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); setProgressBairIndeterminateVisibility(true); 

    E quando terminair com a tairefa que você precisa paira exibir o ProgressBair, esconda o ProgressBair usando este código:

     setProgressBairIndeterminateVisibility(false); 

    Crédito: https://stackoviewflow.com/a/9157874/450534

    Paira compatibilidade total você deve usair:

     setSupportProgressBairIndeterminateVisibility(true); 

    Aqui está um exemplo:

     public class MyActivity extends SherlockFragmentActivity { //... @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); setContentView(R.layout.my_layout); //... setSupportProgressBairIndeterminateVisibility(true); } } 
    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.