Android Processing view
We sometimes see processing view, which is a bit black shadow. 日本語
It indicates can’t touch UI and processing something in background.
There aren’t that kind of view by default(Progress bar or indicator exist).
I made following using View class.
1. Create Layout
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:background="#80000000"> </LinearLayout>
Add only LenearView with transparent black background.
2. Use this view on Acitivity
public class BlackViewActivity extends Activity { private View blackView; private boolean black=false; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ActionBar actionBar = getActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); blackView = getLayoutInflater().inflate(R.layout.shadow, null); blackView.setClickable(false); // No? blackView.setVisibility(View.INVISIBLE); addContentView(blackView, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: if ( !black ) { showBlack(); black = true; } else { hideBlack(); black = false; } return true; default: return super.onOptionsItemSelected(item); } } private void showBlack() { blackView.setVisibility(View.VISIBLE); } private void hideBlack() { blackView.setVisibility(View.INVISIBLE); } }
Use actionbar to switch view for testing.
Wow! This can be one particular of the most helpful blogs We’ve ever arrive across on this subject. Actually Great. I’m also an expert in this topic therefore I can understand your effort.
An outstanding share! I’ve just forwarded this onto a coworker who had been doing a little research on this. And he in fact ordered me breakfast due to the fact that I stumbled upon it for him… lol. So allow me to reword this…. Thanks for the meal!! But yeah, thanx for spending time to discuss this topic here on your web site.