일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 자바문제
- 생활코딩
- Oracle
- python
- 이클립스
- Java
- Mac
- 맥
- Android
- Error
- JDBC
- crud
- html
- pyqt
- 객체지향
- 반복문
- 배열
- Homebrew
- spring
- 자바
- API
- servlet
- 단축키
- jsp
- nodejs
- FastAPI
- 컬렉션프레임워크
- 대덕인재개발원
- ibatis
- ddit
- Today
- Total
romworld
Python 07 - Android (JAVA) 본문
https://developer.android.com/studio
Download Android Studio & App Tools - Android Developers
Android Studio provides app builders with an integrated development environment (IDE) optimized for Android apps. Download Android Studio today.
developer.android.com
- Android Studio에서 다운로드 한다.
android studio의 안단은 intelli j 기반이다.
실행이 되면 linearLayout을 드래그해와서 화면에 설정을 해주고
paletter에 text ,buttons 를 드래그 해준다.
code탭에서 treeview 소스를 지운다.
1. linearLayout을 가장 많이 쓴다.
2. Attributes에서 textsize 40dp
3. layout_height 50dp로 설정
attributes탭에서 id를 tv로 변경
Suppress : Add tools: ignore="MissingConstraints" 를 클릭하면 해결된다.
AndroidManif -> 앱의 처음 화면 . 자바의 web.xml과 같은 역할을 한다.
<activity> = servlet 과 같은 역할
MainActivity = 서블릿의 dopost do get과 같고
activity_main = JSP 와 같다.
버튼을 클릭했을 때 텍스트 바꾸기
package kr.co.aiai.app;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
TextView tv = findViewById(R.id.tv);
Button btn = (Button) findViewById(R.id.btn);
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
tv.setText("Good Evening");
}
});
}
}
.1 OnClickListener 클릭이벤트를 준다.
'Python' 카테고리의 다른 글
Python 09 - (Android)로또게임, 가위바위보, 별찍기 (0) | 2022.12.28 |
---|---|
Python 08 - (Android)(Log.d, 버튼 클릭 이벤트(숫자증가, 홀짝게임)) (1) | 2022.12.28 |
Python 06 - JFrame(2) (JAVA) (0) | 2022.12.27 |
Python 05 - JFrame (JAVA) (0) | 2022.12.26 |
Python 04 - OOP(Object oriented Programming) 객체 지향 프로그래밍 (0) | 2022.12.26 |