Created
April 2, 2014 23:11
-
-
Save akalipetis/9945194 to your computer and use it in GitHub Desktop.
Android Activity with ProgressBar below the ActionBar
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<LinearLayout | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:orientation="vertical"> | |
<ProgressBar | |
android:id="@+id/activity_progress_progress_bar" | |
style="@style/Widget.Sherlock.ProgressBar.Horizontal" | |
android:visibility="gone" | |
android:layout_height="wrap_content" | |
android:layout_width="match_parent"/> | |
<FrameLayout | |
android:id="@+id/activity_progress_container" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent"/> | |
</LinearLayout> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ProgressActivity extends SherlockFragmentActivity { | |
private ProgressBar mProgressBar; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
super.setContentView(R.layout.activity_progress); | |
mProgressBar = (ProgressBar) findViewById(R.id.activity_progress_progress_bar); | |
} | |
@Override | |
public void setContentView(int layoutResID) { | |
LayoutInflater inflater = (LayoutInflater) getSystemService (Context.LAYOUT_INFLATER_SERVICE); | |
ViewGroup container = (ViewGroup) findViewById(R.layout.activity_progress_container); | |
inflater.inflate(layoutResID, container, true); | |
} | |
public void setCustomProgressBarVisibility(boolean visible) { | |
mProgressBar.setVisibility(visible ? View.VISIBLE : View.GONE); | |
} | |
public void setCustomProgressBarIntermediate(boolean intermediate) { | |
mProgressBar.setIndeterminate(intermediate); | |
} | |
public void setCustomProgessBarProgress(int progress) { | |
mProgressBar.setProgress(progress); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment