리스트뷰 어뎁터로 데이터 보여주기


#개념





#메인화면



#아이템이 들어있는 화면 

#엑티비티 main xml

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

<LinearLayout
android:id="@+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">


<Button
android:id="@+id/button"
android:layout_width="99dp"
android:layout_height="wrap_content"
android:text="input" />

<EditText
android:id="@+id/editText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:inputType="textPersonName"
android:text="aaaa" />

<EditText
android:id="@+id/editText2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:inputType="textPersonName"
android:text="010-54568-5435" />

</LinearLayout>


<ListView
android:id="@+id/listView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/linearLayout" />

</RelativeLayout>



#singer_item.xml

<?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="wrap_content"
android:orientation="horizontal">

<ImageView
android:id="@+id/imageView"
android:layout_width="80dp"
android:layout_height="80dp"
android:src="@mipmap/ic_launcher" />

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:orientation="vertical">

<TextView
android:id="@+id/text1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="name"
android:textColor="@color/colorPrimaryDark"
android:textSize="30dp" />


<TextView
android:id="@+id/text2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="tell"
android:textColor="@android:color/holo_orange_light"
android:textSize="24dp" />
</LinearLayout>


</LinearLayout>



#MainActivity.java

package me.happygate.mylist0823;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.Toast;

import java.util.ArrayList;

public class MainActivity extends AppCompatActivity {
SingerAdapter adapter;

EditText editText;
EditText editText2;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

//데이터를 추가할 때 사용될 에딧 텍스트
editText = (EditText) findViewById(R.id.editText);
editText2 = (EditText) findViewById(R.id.editText2);

//리스트 뷰에 어뎁터로 만든 데이터 넣어주기(껍데기)
ListView listView = (ListView) findViewById(R.id.listView);

//알맹이
adapter = new SingerAdapter();

adapter.addItem(new SingerItem("소시", "010-02450-0101", R.drawable.ad));
adapter.addItem(new SingerItem("가시", "010-014510-0101", R.drawable.ad));
adapter.addItem(new SingerItem("진시", "010-0122310-0101", R.drawable.ad));
adapter.addItem(new SingerItem("희시", "010-0122310-0101", R.drawable.ad));
adapter.addItem(new SingerItem("대시", "010-023410-0101", R.drawable.ad));
adapter.addItem(new SingerItem("명시", "010-023410-0101", R.drawable.ad));

//리스트 뷰에 데이터가 들어있는 어댑터를 넣어준다.
listView.setAdapter(adapter);


//리스트뷰를 클릭했을 때!!
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

SingerItem item = (SingerItem) adapter.getItem(position);
Toast.makeText(getApplicationContext(), "선택:" + item.getName(), Toast.LENGTH_SHORT).show();
}
});

//추가 클릭했을 때
Button button = (Button) findViewById(R.id.button);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String name = editText.getText().toString();
String mobile = editText2.getText().toString();
adapter.addItem(new SingerItem(name, mobile, R.drawable.ad));

//리스트뷰 갱신
adapter.notifyDataSetChanged();
}
});
}


//!!!!!!!!!!!!!!!어텝터 정의!!!!!!!!
class SingerAdapter extends BaseAdapter {
//데이터 담을 수 있는 공간 설정
ArrayList<SingerItem> items = new ArrayList<SingerItem>();


//몇개있니?
@Override
public int getCount() {
return items.size();
}

//삽입
public void addItem(SingerItem item) {
items.add(item);

}


//선택한 아이템 번호
@Override
public Object getItem(int position) {

return items.get(position);
}

@Override
public long getItemId(int position) {
return position;
}

//중요 !! 어뎁터가 뷰를 만들어줌 (부분화면 정의한거 리턴)
@Override
public View getView(int position, View convertView, ViewGroup parent) {

//뷰를 만들어 줄때 재사용할 수 있게
//화면에 안보여 지게되는것은 다시 재사용하게 되면서 new로 만들필요 없다.
// 코드 재사용 convertView 사용

SingerItemView view = null;

//convertView null 이면

if (convertView == null) {

view = new SingerItemView(getApplicationContext());

} else {
//이전에 섰던 데이터 singeritemview로 캐스팅해서 재사용
view = (SingerItemView) convertView;

}

//위에서 정의한 arraylist 에서 하나하나의 데이터를 가져와서
//String item 객체에 담는다.
SingerItem item = items.get(position);

// SingerItemView 클래스에 정의한 set 메서드에 데이터를 담아서 리턴한다.
view.setName(item.getName());
view.setMobile(item.getMobile());
view.setImage(item.getResId());

return view;
}
}

}

#SingerItem.java

package me.happygate.mylist0823;

/**
* Created by kang on 2017-08-23.
*/

public class SingerItem {

String name;
String mobile;
int resId;

public SingerItem(String name, String mobile, int resId) {
this.name = name;
this.mobile = mobile;
this.resId = resId;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public String getMobile() {
return mobile;
}

public void setMobile(String mobile) {
this.mobile = mobile;
}

public int getResId() {
return resId;
}

public void setResId(int resId) {
this.resId = resId;
}
}

#SingerItemView.java

package me.happygate.mylist0823;

import android.content.Context;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

/**
* Created by kang on 2017-08-23.
*/

public class SingerItemView extends LinearLayout {

TextView textView;
TextView textView2;
ImageView imageView;

//viwe를 위한 필수 생성자 2
public SingerItemView(Context context) {
super(context);

init(context);
}

public SingerItemView(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
init(context);
}


private void init(Context context) {
//단말이 시작될때 기본적으로 뒤에서 실행
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

//단말이 시작될때 리스트 아이템 디자인을 정의한 singer_item.xml
// activity_main.xml에 정의한 리니어 레이아웃에 달라 붙는다.
inflater.inflate(R.layout.singer_item, this, true);

//singer_item 에 정의한 것들 선택자 가져오기
textView = (TextView) findViewById(R.id.text1);
textView2 = (TextView) findViewById(R.id.text2);
imageView = (ImageView) findViewById(R.id.imageView);
}

//MainActivity getView() 에서 setName 이 호출되면 값을 textView 에 넣어준다.
public void setName(String name) {

textView.setText(name);
}

public void setMobile(String mobile) {

textView2.setText(mobile);
}

public void setImage(int resId) {

imageView.setImageResource(resId);
}
}



버튼을 비트맵 이미지로 바꾸기


#개념



#결과화면


#메인 엑티비티 레이아웃.xml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<?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">
 
 
    <me.happygate.my0823.BitmapButton
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="helloWorld"/>
 
</LinearLayout>
 
cs

#메인 엑티비티.java


1
2
3
4
5
6
7
8
9
10
11
12
13
14
package me.happygate.my0823;
 
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
 
public class MainActivity extends AppCompatActivity {
 
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }
}
 
cs


#버튼을 상속한 새로운 클래스 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
package me.happygate.my0823;
 
import android.content.Context;
import android.support.v7.widget.AppCompatButton;
import android.util.AttributeSet;
import android.view.MotionEvent;
 
/**
 * Created by kang on 2017-08-23.
 */
 
//BitmapButton 클래스는 AppCompatButton을 상속한다
public class BitmapButton extends AppCompatButton {
 
    //생성자 만들어주기
    public BitmapButton(Context context) {
        super(context);
        init(context);
    }
 
    public BitmapButton(Context context, AttributeSet attrs) {
        super(context, attrs);
 
        init(context);
 
    }
 
    private void init(Context context) {
 
        //버튼 배경이미지 설정
        setBackgroundResource(R.drawable.a);
 
        //버튼 글자 크기 지정
        //dimens xml 에서 버튼 크기 지정했다.
        float textSize = getResources().getDimension(R.dimen.text_size);
        setTextSize(textSize);
    }
 
    //버튼을 손가락으로 터치했을 때 발생하는 이벤트
    @Override
    public boolean onTouchEvent(MotionEvent event) {
 
        int action = event.getAction();
 
        switch (action) {
            //버튼이 눌려졌을 때
            case MotionEvent.ACTION_DOWN:
                setBackgroundResource(R.drawable.b);
                break;
            //버튼이 때졌을 때
            case MotionEvent.ACTION_UP:
                setBackgroundResource(R.drawable.a);
                break;
        }
 
        invalidate();
        return true;
    }
}
 
cs


#dimen.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>

<dimen name="text_size">16dp</dimen>

</resources>

#파일 위치 및 경로


액션바 탭바 프레그먼트


#개념



#화면


#설정


왼족 네비게이션 바에서 values-> style.xml 들어가서 parent 부분을 NoActionBar로 해준다.

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">

외부라이브러리 추가

file->project structure -> app -> dependenc.. ->  + 클릭 -> 라이브러리 디펜텐시스 com.android.support.design 클릭-> ok


build gradle 적용(맨밑에)

compile 'com.android.support:design:25.+'


#메인 엑티비티 레이아웃

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto">
 
 
    //전체 레이아웃 잡아줌
     <android.support.design.widget.CoordinatorLayout
         android:layout_width="match_parent"
         android:layout_height="match_parent">
 
         //액션바 레이아웃
         <android.support.design.widget.AppBarLayout
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
 
 
             //툴바정의
             <android.support.v7.widget.Toolbar
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
                 android:background="@color/colorPrimaryDark"
                 android:elevation="1dp"
                 android:id="@+id/toolbar">
             </android.support.v7.widget.Toolbar>
 
 
             //탭레이아웃(탭버튼을 담는다.)
             <android.support.design.widget.TabLayout
                 android:id="@+id/tabs"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
                 android:elevation="1dp"
                 android:background="@android:color/background_light"
                 app:tabMode="fixed"
                 app:tabGravity="fill"
                 app:tabTextColor="@color/colorPrimary"
                 app:tabSelectedTextColor="@color/colorAccent">
             </android.support.design.widget.TabLayout>
 
 
         </android.support.design.widget.AppBarLayout>
 
 
         //프레그먼트 넣을 곳
         <FrameLayout
             android:id="@+id/container"
             android:layout_width="match_parent"
             android:layout_height="match_parent"
             app:layout_behavior="@string/appbar_scrolling_view_behavior">
         </FrameLayout>
 
     </android.support.design.widget.CoordinatorLayout>
 
</RelativeLayout>
 
cs


#프레그먼트 1,2,3 레이아웃

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<?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="match_parent">
 
    <TextView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:text="fragment1"
        android:textSize="40dp"
        android:background="@android:color/holo_purple"
        />
 
</LinearLayout>
cs


#메인 엑티비티.java

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
package me.happygate.myactionbar;
 
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
 
public class MainActivity extends AppCompatActivity {
 
    Fragment1 fragment1;
    Fragment2 fragment2;
    Fragment3 fragment3;
 
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
 
 
        //1툴바 설정
        Toolbar toolbar=(Toolbar)findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);
 
 
        //2xml 프래그먼트를 보여주기
 
        fragment1=new Fragment1();
 
        fragment2=new Fragment2();
 
        fragment3=new Fragment3();
 
        //프레그먼트를 메니져로 보여줌
        getSupportFragmentManager().beginTransaction().add(R.id.container,fragment1).commit();
 
 
 
 
        //3탭기능 구성
        TabLayout tabs=(TabLayout)findViewById(R.id.tabs);
        tabs.addTab(tabs.newTab().setText("친구"));
        tabs.addTab(tabs.newTab().setText("일대일채팅"));
        tabs.addTab(tabs.newTab().setText("기타"));
 
 
 
        //탭버튼을 클릭했을 때 프레그먼트 동작
        tabs.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
            @Override
            public void onTabSelected(TabLayout.Tab tab) {
 
                //선택된 탭 번호 반환
                int position =tab.getPosition();
 
                Fragment selected = null;
 
                if(position == 0 ){
 
                    selected = fragment1;
 
                }else if(position == 1 ){
 
                    selected =fragment2;
 
                }else if(position == 2 ){
 
                    selected =fragment3;
                }
 
                //선택된 프레그먼트로 바꿔줌
                getSupportFragmentManager().beginTransaction().replace(R.id.container, selected).commit();
            }
 
            @Override
            public void onTabUnselected(TabLayout.Tab tab) {
 
 
            }
 
            @Override
            public void onTabReselected(TabLayout.Tab tab) {
 
            }
        });
 
    }
}
 
cs


#프레그먼트1,2,3 .java

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package me.happygate.myactionbar;
 
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
 
 
public class Fragment1 extends Fragment {
 
    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
 
        // xml 로 만들어준 프레그먼트를 자바 단에서 만들어줌
        ViewGroup rootGroup =(ViewGroup)inflater.inflate(R.layout.fragment1,container,false);
        return  rootGroup;
 
    }
}
 
cs




상대 레이아웃


#화면 




#소스

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
 
 
    <RelativeLayout
        android:id="@+id/r1"
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:layout_toLeftOf="@id/r2"
        android:background="#fff000"></RelativeLayout>
 
 
    <RelativeLayout
        android:id="@+id/r2"
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:layout_above="@id/r4"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"
        android:background="#4c219e"></RelativeLayout>
 
    <RelativeLayout
        android:id="@+id/r3"
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        android:layout_below="@id/r1"
        android:background="#694430"></RelativeLayout>
 
    <RelativeLayout
        android:id="@+id/r4"
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:layout_alignParentBottom="true"
        android:layout_alignParentRight="true"
        android:layout_toRightOf="@id/r3"
        android:background="#00f957"></RelativeLayout>
 
 
    <RelativeLayout
        android:id="@+id/r5"
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:layout_above="@id/r4"
        android:layout_below="@id/r1"
        android:layout_toLeftOf="@id/r2"
        android:layout_toRightOf="@id/r3"
        android:background="#f45eff"></RelativeLayout>
 
 
</RelativeLayout>
cs


리니어 레이아웃 연습


#화면



#소스

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<?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">
 
 
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="3">
 
 
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:background="#c62424"></LinearLayout>
 
 
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:background="#fabebe"></LinearLayout>
 
    </LinearLayout>
 
 
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="3">
 
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:background="#0fe72f"></LinearLayout>
 
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:background="#251f1d"></LinearLayout>
 
 
    </LinearLayout>
 
 
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="3">
 
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:background="#4b119bda"></LinearLayout>
 
 
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:background="#b103e1"></LinearLayout>
 
    </LinearLayout>
 
 
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1">
 
 
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:background="#69a16a">
 
            <Button
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:background="#69a16a"
                android:text="home"
                android:textStyle="bold" />
 
        </LinearLayout>
 
 
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:background="#fabebe">
 
            <Button
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:background="#fabebe"
                android:text="home"
                android:textStyle="bold" />
        </LinearLayout>
 
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:background="#f16060">
 
            <Button
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:background="#f16060"
                android:text="home"
                android:textStyle="bold" />
 
        </LinearLayout>
 
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:background="#154770">
 
            <Button
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:background="#154770"
                android:text="home"
                android:textStyle="bold" />
        </LinearLayout>
 
    </LinearLayout>
 
 
</LinearLayout>
cs


프레그먼트로 이미지뷰 띄우기


#결과화면


#mainActivity.xml


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?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="match_parent"
    >
 
    <fragment
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:name="me.happygate.myfragment2.ListFragment"
        android:id="@+id/listFragment" />
 
    <fragment
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:name="me.happygate.myfragment2.ViewerFragment"
        android:id="@+id/viewFragment" />
 
</LinearLayout>
 
cs


#mainActivity.java

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package me.happygate.myfragment2;
 
import android.os.Bundle;
import android.support.v4.app.FragmentManager;
import android.support.v7.app.AppCompatActivity;
 
public class MainActivity extends AppCompatActivity {
 
    ListFragment fragment1;
    ViewerFragment fragment2;
    FragmentManager manager;
 
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
 
        manager = getSupportFragmentManager();
 
        //프래그먼트메니져로 xml에 정의된 프래그먼트 찾기
        fragment1 = (ListFragment) manager.findFragmentById(R.id.listFragment);
        fragment2 = (ViewerFragment) manager.findFragmentById(R.id.viewFragment);
 
    }
 
    public void onImageChange(int index){
 
        fragment2.setImage(index);
 
    }
}
 
cs



#listFragment.xml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?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="match_parent">
 
    <Button
        android:id="@+id/button"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="image1" />
 
    <Button
        android:id="@+id/button2"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="image2" />
 
    <Button
        android:id="@+id/button3"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="image3" />
</LinearLayout>
cs


#listFragment.java

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package me.happygate.myfragment2;
 
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
 
/**
 * Created by kang on 2017-08-17.
 */
 
public class ListFragment extends Fragment {
    MainActivity activity;
    @Override
    public void onAttach(Context context) {
        super.onAttach(context);
 
        activity=(MainActivity)getActivity();
    }
 
    @Override
    public void onDetach() {
        super.onDetach();
        activity = null;
    }
 
    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        ViewGroup rootView=(ViewGroup)inflater.inflate(R.layout.fragment_list,container,false);
 
 
        Button button =(Button)rootView.findViewById(R.id.button);
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
 
            activity.onImageChange(0);
 
            }
        });
 
 
        Button button2 =(Button)rootView.findViewById(R.id.button2);
        button2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                activity.onImageChange(1);
            }
        });
 
 
        Button button3 =(Button)rootView.findViewById(R.id.button3);
        button3.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                activity.onImageChange(2);
            }
        });
 
 
        return rootView;
    }
}
 
cs


#viewFragment.xml

1
2
3
4
5
6
7
8
9
10
11
12
<?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="match_parent">
 
    <ImageView
        android:id="@+id/imageView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:src="@drawable/a" />
</LinearLayout>
cs


#viewFragment.java

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package me.happygate.myfragment2;
 
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
 
/**
 * Created by kang on 2017-08-17.
 */
 
public class ViewerFragment extends Fragment {
 
    ImageView imageView;
 
    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        ViewGroup rootView=(ViewGroup)inflater.inflate(R.layout.fragment_viewer,container,false);
 
         imageView = (ImageView)rootView.findViewById(R.id.imageView);
 
        return rootView;
    }
 
 
    public void setImage(int index){
 
        if (index==0){
            imageView.setImageResource(R.drawable.a);
        }else if(index==1){
            imageView.setImageResource(R.drawable.d);
        }else if (index==2){
            imageView.setImageResource(R.drawable.e);
        }
 
 
    }
}
 
cs


#사진파일은 drawable 폴더에


프레그먼트


#결과화면

main버튼과 menu버튼을 누르면 밑에 fragment 화면이 바뀐다.

#mainActivity.xml


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
 
    <Button
        android:id="@+id/button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:layout_alignParentTop="true"
        android:text="main" />
 
 
    <FrameLayout
        android:id="@+id/container"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_below="@+id/button">
 
<!--  xml로 프래그먼트 만들기      <fragment
            android:id="@+id/mainFragment"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:name="me.happygate.myfragment.MainFragment"></fragment>-->
 
    </FrameLayout>
 
    <Button
        android:id="@+id/button2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_marginLeft="21dp"
        android:layout_marginStart="21dp"
        android:layout_toEndOf="@+id/button"
        android:layout_toRightOf="@+id/button"
        android:text="menu" />
 
</RelativeLayout>
 
cs

#mainActivity.java

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
package me.happygate.myfragment;
 
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Button;
 
public class MainActivity extends AppCompatActivity {
 
    MainFragment fragment1;
    MenuFragment fragment2;
 
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
 
 
        //프래그먼트 객체 만들기
        //프레그먼트 안에 들어가는 최상위 레이아웃 리턴 rootView
        fragment1 = new MainFragment();
        //프레그먼트 안에 들어가는 최상위 레이아웃 리턴 rootView
        fragment2 = new MenuFragment();
 
 
        //자바 소스로 프래그먼트 불러오기
        Button button =(Button)findViewById(R.id.button);
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
 
 
                getSupportFragmentManager().beginTransaction().replace(R.id.container, fragment1).commit();
            }
        });
 
 
        Button button2 =(Button)findViewById(R.id.button2);
        button2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
 
 
                //
                getSupportFragmentManager().beginTransaction().replace(R.id.container, fragment2).commit();
            }
        });
 
    }
 
//프래그먼트 안의 버튼을 클릭했을 때 작동하는 함수
 
    public void onFragmentChange(int index){
 
       
 
        if(index == 0 ){
            getSupportFragmentManager().beginTransaction().replace(R.id.container, fragment1).commit();
 
        }else if(index == 1){
            getSupportFragmentManager().beginTransaction().replace(R.id.container, fragment2).commit();
        }
 
    }
 
}
 
cs




#mainFragment.java

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package me.happygate.myfragment;
 
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
 
/**
 * Created by kang on 2017-08-17.
 */
 
 
//인플레이터를 통해서 프래그먼트xml과 연결시켜 준다.
    //프레그먼트는 실제 화면은 아니다. 화면을 담기위한 틀이다.
public class MainFragment extends Fragment {
 
    MainActivity activity;
 
    //프래그먼트가 엑티비티위에 올라갈때 호출되는 함수
    @Override
    public void onAttach(Context context) {
        super.onAttach(context);
 
        //참고:엑티비티 위에 프래그먼트가 올라가서 동작한다.
        //이 프레그먼트가 동작하는 엑티비티를 참조할 수 있다.
        //mainactivity를 참조한다.
        //getActivity();
        activity = (MainActivity) getActivity();
 
    }
 
    @Override
    public void onDetach() {
        super.onDetach();
        activity = null;
    }
 
    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        //(프레그먼트를 , 여기에 붙여달라.)
        ViewGroup rootView=(ViewGroup)inflater.inflate(R.layout.fragment_main,container,false);
        //인플레이션 후 메모리에 올라간다. id로 찾을 수 있다.
 
        //프레그먼트 안에 들어가있는 버튼
        Button button = (Button)rootView.findViewById(R.id.button);
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //프래그먼트 안에서 버튼으로 메뉴화면 호출
                Log.d("main fragment""onFragmentChange");
                activity.onFragmentChange(1);
            }
        });
 
 
        //프레그먼트 안에 들어가는 최상위 레이아웃 리턴
        return rootView;
 
 
    }
}
 
 
cs


#mainFragment.xml


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?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:background="@android:color/holo_orange_dark"
    android:orientation="vertical">
 
    <TextView
        android:id="@+id/textView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="fragment1"
        android:textSize="40dp" />
 
    <Button
        android:id="@+id/button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="to Menu Page" />
</LinearLayout>
cs




#MenuFragment.java

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package me.happygate.myfragment;
 
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
 
/**
 * Created by kang on 2017-08-17.
 */
 
 
//인플레이터를 통해서 프래그먼트xml과 연결시켜 준다.
    //프레그먼트는 실제 화면은 아니다. 화면을 담기위한 틀이다.
public class MenuFragment extends Fragment {
    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
 
        ViewGroup rootView=(ViewGroup)inflater.inflate(R.layout.fragment_menu,container,false);
        //(프레그먼트를 , 여기에 붙여달라.)
 
        //프레그먼트 안에 들어가는 최상위 레이아웃 리턴
        return rootView;
 
 
    }
}
 
cs


#MenuFragment.xml


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?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:background="@android:color/holo_blue_bright"
    android:orientation="vertical">
 
    <TextView
        android:id="@+id/textView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="fragment2"
        android:textSize="40dp" />
 
    <Button
        android:id="@+id/button2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="to main Page" />
</LinearLayout>
cs


#프래그먼트 개념








화면에 애니메이션 효과 적용하기


#결과화면


#mainActivitiy.xml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    >
 
   <LinearLayout
       android:layout_width="match_parent"
       android:layout_height="match_parent"
       android:background="#ff5555ff">
 
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="base area"
        android:textSize="30dp"
        android:textColor="#ffffff"/>
   </LinearLayout>
 
    <LinearLayout
        android:id="@+id/page"
        android:layout_width="200dp"
        android:layout_height="match_parent"
        android:orientation="vertical"
        android:layout_gravity="right"
        android:background="#ffffff66"
        android:visibility="invisible">
 
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="sliding area"
            android:textSize="30dp"
            android:textColor="#000000"/>
    </LinearLayout>
 
    <Button
        android:id="@+id/button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="OPEN"
        android:layout_gravity="center_vertical|right"/>
 
</FrameLayout>
 
cs


#mainActivity.java

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
package me.happygate.myapplicationlayout;
 
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.Button;
import android.widget.LinearLayout;
 
public class MainActivity extends AppCompatActivity {
 
    LinearLayout page;
    Animation translateLeft;
    Animation translateRight;
    Button button;
    //열렸는지 안열렸는지 체크
    boolean isPageOpen = false;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
 
        //숨겨진 리니어 레이아웃
        page = (LinearLayout)findViewById(R.id.page);
 
        //애니메이션 옵션이 설정된 xml 파일을 AnimationUtils통해서 가져오기

        translateLeft = AnimationUtils.loadAnimation(this,R.anim.translate_left);
        translateRight = AnimationUtils.loadAnimation(this,R.anim.translate_right);
 
 
        //3.애니메이션에 옵션을 적용시킨다.
        SlidingAnimationListener listener = new SlidingAnimationListener();
        translateLeft.setAnimationListener(listener);
        translateRight.setAnimationListener(listener);
 
        button =(Button)findViewById(R.id.button);
        //1버튼 눌렸을 때
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
 
                //화면이 오른쪽으로 열려있다면
                if(isPageOpen){
                    //레이아웃을 오른쪽으로 열어줘라
                    page.startAnimation(translateRight);
                }else{
                    //화면 왼쪽으로 닫기
                    page.setVisibility(View.VISIBLE);
                    page.startAnimation(translateLeft);
                }
 
            }
        });
    }
 
 
    //2애니메이션 동작을 위해  Animation.AnimationListener를 구현한 클래스 생성
    class SlidingAnimationListener implements Animation.AnimationListener{
 
        @Override
        public void onAnimationStart(Animation animation) {
 
        }
 
        @Override
        public void onAnimationEnd(Animation animation) {
            //애니메이션이 끝날때 동작
 
            if(isPageOpen){
                //애니메이션이 끝날때 페이지가 열려있는 상태다하면
                //오른쪽으로 열려있다. 즉 보이지 않는다.
                page.setVisibility(View.INVISIBLE);
                button.setText("열기");
                isPageOpen = false;
            }else{
                button.setText("닫기");
                isPageOpen = true;
            }
        }
 
        @Override
        public void onAnimationRepeat(Animation animation) {
 
        }
    }
 
}
 
cs


#애니메이션을 정의한 xml



안드로이드 애니메이션

#개념


#화면

#자바소스


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
package me.happygate.myapplication0101;
 
import android.app.ProgressDialog;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ProgressBar;
import android.widget.SeekBar;
 
public class MainActivity extends AppCompatActivity {
 
    EditText editText ;
    ProgressBar progressBar;
 
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
 
 
        editText=(EditText)findViewById(R.id.editText);
        progressBar=(ProgressBar)findViewById(R.id.progressBar);
 
        Button button =(Button)findViewById(R.id.button);
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
            //클릭했을 때
                //텍스트 안에 있는 글자 공백제거
                String inputStr = editText.getText().toString().trim();
                //숫자로 타입변환
                int input =Integer.parseInt(inputStr);
                //프로그레스바에 적용
                progressBar.setProgress(input);
            }
        });
 
        Button button2 =(Button)findViewById(R.id.button2);
        button2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //클릭했을 때
 
                showProgressDialog();
            }
        });
 
 
        SeekBar seekBar = (SeekBar)findViewById(R.id.seekBar);
        //시크바가 바뀔때 작동되는 리스너
        seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
            @Override
            public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
 
                editText.setText(String.valueOf(progress));
            }
 
            @Override
            public void onStartTrackingTouch(SeekBar seekBar) {
 
            }
 
            @Override
            public void onStopTrackingTouch(SeekBar seekBar) {
 
            }
        });
 
 
    }
    //원형 프로그레스 바 뛰우기
    private void showProgressDialog(){
 
        ProgressDialog dialog=new ProgressDialog(this);
        dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
        dialog.setMessage("데이터 불러오는 중");
        dialog.show();
    }
 
 
}
 
cs


#애니메이션이 적용될 xml



프로그레스바&시크바

#화면


#소스

1프로그레스바

2시크바

3원형 프로그레스바

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
package me.happygate.myapplication0101;
 
import android.app.ProgressDialog;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ProgressBar;
import android.widget.SeekBar;
 
public class MainActivity extends AppCompatActivity {
 
    EditText editText ;
    ProgressBar progressBar;
 
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
 
 
        editText=(EditText)findViewById(R.id.editText);
        progressBar=(ProgressBar)findViewById(R.id.progressBar);
 
        Button button =(Button)findViewById(R.id.button);
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
            //1클릭했을 때
                //텍스트 안에 있는 글자 공백제거
                String inputStr = editText.getText().toString().trim();
                //숫자로 타입변환
                int input =Integer.parseInt(inputStr);
                //프로그레스바에 적용
                progressBar.setProgress(input);
            }
        });
 

        Button button2 =(Button)findViewById(R.id.button2);
        button2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //클릭했을 때
 
                showProgressDialog();
            }
        });
 
 
        SeekBar seekBar = (SeekBar)findViewById(R.id.seekBar);
        //2시크바가 바뀔때 작동되는 리스너
        seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
            @Override
            public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
 
                editText.setText(String.valueOf(progress));
            }
 
            @Override
            public void onStartTrackingTouch(SeekBar seekBar) {
 
            }
 
            @Override
            public void onStopTrackingTouch(SeekBar seekBar) {
 
            }
        });
 
 
    }

    //3 원형 프로그레스 바 뛰우기
    private void showProgressDialog(){
 
        ProgressDialog dialog=new ProgressDialog(this);
        dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
        dialog.setMessage("데이터 불러오는 중");
        dialog.show();
    }
 
 
}
 
cs


+ Recent posts

티스토리 툴바