1
Toast.makeText(this"사스가 토오스트"1).show();
cs

1
2
3
4
5
6
7
8
9
10
        toastBtn.setOnClickListener(new View.OnClickListener() {
            
            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub
                Toast.makeText(getApplicationContext(), "토오스트 떳다!"1).show();
                            //메인엑티비티가 멤버함수로(상속받아서) 가지고 있는 저 함수를 불러서
                            // 컨텍스트 객체를 받아오든가
            }
        });
cs

1
2
3
                Toast.makeText(MainActivity.this"토오스트 떳다!"1).show();
                              //이벤트 처리 객체를 가리키는 this가 아닌 
                              //엑티비티를 가리키는 this
cs


1
2
3
4
5
6
7
8
9
10
11
12
13
        chk1.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            
            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                // TODO Auto-generated method stub
                Toast.makeText(MainActivity.this,
                        buttonView.getText()+"이"+(isChecked ? "선택":"해제")+"되었습니다."0).show();
                if(isChecked)
                    chk2.setChecked(false);
                
                
            }
        });
cs



ViewGroup은 자신 내부에 다른 위젯을 담을 수 있는 컨테이너

자바로 치면 프레임이나 패널 같은 녀석

ViewGrouo은 위젯들의 부모클래스인 View를 멤버로 유지할건데 ViewGroup자체도 View를 상속받음


ViewGroup : 뷰들을 담고있는 그룹, 뷰그룹은 뷰들을 배치하는 역할

다양한 뷰그룹(레이아웃)

- 리니어 레이아웃 : 박스모델, 사각형 영역들을 이용해 화면을 구성

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="${relativePackage}.${activityClass}" 
    android:orientation="horizontal">
    
    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="btn1"
        android:layout_weight="1"/>
    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="btn2"
        android:layout_weight="1"/>
    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="btn3"
        android:layout_weight="1"/>
 
</LinearLayout>
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
    <LinearLayout 
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:orientation="horizontal"
        android:gravity="center">
        
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="btn1_1"
            android:layout_gravity="top"/>
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="btn1_2"
            android:layout_gravity="center"/>
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="btn1_3"
            android:layout_gravity="bottom"/>
    </LinearLayout>
    
    
    <Button
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:text="btn4"
        android:layout_weight="1"
        android:gravity="bottom|center"/>
cs




' IOT 기반 응용 SW과정 > Android, Arduino' 카테고리의 다른 글

Day89 안드로이드 엑티비티 전환  (0) 2016.07.25
Day88  (0) 2016.07.22
Day87  (0) 2016.07.21
Day85 안드로이드 액티비티  (0) 2016.07.19
Day84 안드로이드  (0) 2016.07.18

컨텍스트 경로는 웹 어플리케이션이 동작중인 서버가 각 웹 어플리케이션을 구분하기 위한 경로


종류 

사용용도 

형식 

  스크립트릿(scriptlet)

 자바 코드를 기술함 

 <% %> 

  선언문(declaration)

 변수와 메소드를 선언함 

 <%! %> 

  표현식(expression)

 계산식이나 함수를 호출한 결과를 문자열 형태로 출력함 

 <%= %>

  주석(comment)

 JSP 페이지에 설명을 넣음 

 <%--  --%> 


Jsp로 작성된 파일은 요청에 대해 응답이 되어질때 서블릿으로 변환됨

1. 요청이 들어옴

2. jsp파일을 서블릿으로 코드 변환함(java파일 생성)

3. 2를 컴파일함(class 파일 생성)

4. 3을 실행함(객체생성 혹은 메모리 로드)

5. 4객체의 요청처리 메소드를 호출(_jspService() 메소드)


요청이 들어왔을시 객체가 없으면 4 실행, 3이 없으면 2,3 실행

jsp코드는 _jspService메소드로 번역될때 html은 out객체의 출력으로 스크립트릿의 코드는 

그냥 자바코드로해서 _jspService메소드로 복붙됨(멤버함수 내의 코드로)

jsp가 번역되는 서블릿의 멤버함수나 변수를 넣고 싶으면 선언문으로 작성 <%! ~~~ %>

' IOT 기반 응용 SW과정 > Web Programing' 카테고리의 다른 글

Day37 액션태그  (0) 2016.05.10
Day36 내장 객체의 영역, 액션태그  (0) 2016.05.09
Day35 JSP  (0) 2016.05.04
Day34 JSP 내장 객체  (0) 2016.05.03
Day32 Web Programming // JSP  (0) 2016.04.29

+ Recent posts