package com.moonlight_aska.android.progressbar01;
import android.app.Activity;
import android.os.Bundle;
import android.widget.ProgressBar;
public class ProgressBar01 extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ProgressBar progBar = (ProgressBar)findViewById(R.id.progbar_id);
// 最大値を設定する.
progBar.setMax(100);
// プログレスバーの値を設定する.
progBar.setProgress(50);
// セカンダリ値を設定する.
progBar.setSecondaryProgress(70);
}
}
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<ProgressBar android:id="@+id/progbar_id"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:indeterminate="false"
style="?android:attr/progressBarStyleHorizontal"
/>
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<ProgressBar android:id="@+id/progbar01_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:indeterminate="false"
style="?android:attr/progressBarStyleSmall"
/>
<ProgressBar android:id="@+id/progbar02_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:indeterminate="false"
style="?android:attr/progressBarStyle"
/>
<ProgressBar android:id="@+id/progbar03_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:indeterminate="false"
style="?android:attr/progressBarStyleLarge"
/>
</LinearLayout>