결과화면

 

 

package com.example.demo;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.widget.Button;

public class ProgressBarDemo3 extends Activity {
 private boolean mToggle = false;
 
 protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);

  requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
  setContentView(R.layout.progress_3);
  setProgressBarIndeterminateVisibility(mToggle);
  
  Button button = (Button)findViewById(R.id.toggle);
  button.setOnClickListener(new Button.OnClickListener(){
   public void onClick(View v){
    mToggle = !mToggle;
    setProgressBarIndeterminateVisibility(mToggle);
   }
  });
 }
}

 

 <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <Button android:id="@+id/toggle"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/progressbar_4_toggle" />

</LinearLayout>

//String.xml에 다음 코드 추가~~

 

 <string name="progressbar_4_toggle">Toggle Indeterminate</string>

 

'2020년도 이전 > [WebSig] Android' 카테고리의 다른 글

HScrollView Demo  (0) 2013.08.14
SeekBar Demo  (0) 2013.08.13
ProgressBar Demo2 -> 원형 프로그레스 바  (0) 2013.08.13
ProgressBar Demo1  (0) 2013.08.13
Image Demo  (0) 2013.08.13

+ Recent posts