본문 바로가기

플밍 is 뭔들/안드로이드_인강

11-3. 팝업대화상자

※ ProgressBar

※ 구현
MainActivity
public class MainActivity extends Activity {
      Button btn;
      ProgressDialog pd;
      
      @Override
      protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
            
            btn = (Button) findViewById(R.id.bt_01);
            btn.setOnClickListener(listener);
                  
      }
      
      OnClickListener listener = new OnClickListener() {
            
            @Override
            public void onClick(View v) {
                  // TODO Auto-generated method stub
                  pd = new ProgressDialog(MainActivity.this);
                  pd.setProgressStyle(ProgressDialog.STYLE_SPINNER);
                  pd.setIcon(R.drawable.ic_launcher);
                  pd.setTitle("Download");
                  pd.setMessage("progress....");
                  pd.show();
            }
      };
}

activity_main
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="com.example.android_19_1_ex1.MainActivity" >
   
    <Button
        android:id="@+id/bt_01"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="10px"
        android:text="ProgressDialog" />
   
 
</LinearLayout>



'플밍 is 뭔들 > 안드로이드_인강' 카테고리의 다른 글

12-2. 알람  (0) 2016.11.28
12-1. 노티(Notification)바  (0) 2016.11.27
11-2. 팝업대화상자  (0) 2016.11.27
11-1. 팝업대화상자  (0) 2016.11.27
10-1. 액션바 & 옵션메뉴  (0) 2016.11.27