Listener Event
1. Layout view를 reference 하는 곳에 보통 사용한다.
2. touchhandler를 생성해서 등록해 onCreate()에서 Override 한다.
Click Event
1. OnClickListener의 onClick() 메소드를 Override
2. new OnClickListener로 Listener 객체 생성
'내 공부 > 안드로이드' 카테고리의 다른 글
Android Application 타이틀바 제거 (0) | 2015.02.09 |
---|---|
Android Splash screen (0) | 2015.02.02 |
안드로이드 JAVA Listener 사용 (0) | 2015.01.29 |
안드로이드 layout - 예제:계산기 (0) | 2015.01.28 |
안드로이드 기본 (2) | 2015.01.27 |
Android Application 타이틀바 제거
타이틀바 없는 앱으로 실행
>> Android Manifest.xml의 android:theme수정
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
앱 실행 후 타이틀바 제거
>>ManiActivity파일 onCreate에 setContentView 위에 추가
requestWindowFeature(Window.FEATURE_NO_TITLE);
'내 공부 > 안드로이드' 카테고리의 다른 글
Android Listener 개념 이해 (0) | 2015.02.09 |
---|---|
Android Splash screen (0) | 2015.02.02 |
안드로이드 JAVA Listener 사용 (0) | 2015.01.29 |
안드로이드 layout - 예제:계산기 (0) | 2015.01.28 |
안드로이드 기본 (2) | 2015.01.27 |
안드로이드 Splash screen
계산기에 아무 이미지 (yahoo)나 가져와서 입혀보았다.
workspace명/project명/res/drawable-hdpi/*.png
MainActivity.java
>>
setContentView 호출 후
startActivity(new Intent(this,Splash.class));
Splash.java
>>
public class Splash extends Activity{ // Activity 상속
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
Handler hd = new Handler();
hd.postDelayed(new Runnable() {
@Override
public void run() {
finish(); // 3 초후 이미지를 닫아버림, 스플래시스크린 종료
}
}, 3000);
}
splash.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"
android:background="@drawable/splash_img"> <!-- png파일 이름 : splash_img.png -->
</RelativeLayout>
AndroidManifest.xml
>>
<application>
<activity android:name=".Splash" android:theme="@android:style/Theme.NoTitleBar" />
<!-- 기존 activity 위에 추가, .Splash는 splash 실행하는 java 파일명 -->
</application>
Splash screen MainActivity 동작
'내 공부 > 안드로이드' 카테고리의 다른 글
Android Listener 개념 이해 (0) | 2015.02.09 |
---|---|
Android Application 타이틀바 제거 (0) | 2015.02.09 |
안드로이드 JAVA Listener 사용 (0) | 2015.01.29 |
안드로이드 layout - 예제:계산기 (0) | 2015.01.28 |
안드로이드 기본 (2) | 2015.01.27 |
계산기 Layout - Linear Layout
---가장 큰 레이아웃--- android:layout_width="match_parent"
android:layout_height="match_parent" 를 기본으로 한다.
android:orientation="vertical"
----TextView ---- android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_weight="5"
----BUTTON----- android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_weight="1"
// 각 horizontal라인마다 차지하는 비율을 말한다.
// 아래 sample에서는 textview의 LinearLayout weight은 4~5, Button 한 줄의 LinearLayout weight은 1로 한다.
'내 공부 > 안드로이드' 카테고리의 다른 글
Android Listener 개념 이해 (0) | 2015.02.09 |
---|---|
Android Application 타이틀바 제거 (0) | 2015.02.09 |
Android Splash screen (0) | 2015.02.02 |
안드로이드 JAVA Listener 사용 (0) | 2015.01.29 |
안드로이드 기본 (2) | 2015.01.27 |
Log.d(tag,msg)
msg의 내용을 보여준다.
Log.e(tab,msg)
Toast Message 유저에게 알림 메세지
Toast.makeText(getApplicationContext(), "gayeon toast message", Toast.LENGTH_LONG).show();
: adroid application context에 두번째 아규먼트를 넣어 보여준다.
activity_main.xml 파일에서
android:id="@+id/gayeonButton"
는 gen/R.java에
public static final class id {
public static final int gayeonButton=0x7f060000;
}
로 저장된다. >> xml에서 만든 gayeonButton을 자바에서 사용하기 위해서
'내 공부 > 안드로이드' 카테고리의 다른 글
Android Listener 개념 이해 (0) | 2015.02.09 |
---|---|
Android Application 타이틀바 제거 (0) | 2015.02.09 |
Android Splash screen (0) | 2015.02.02 |
안드로이드 JAVA Listener 사용 (0) | 2015.01.29 |
안드로이드 layout - 예제:계산기 (0) | 2015.01.28 |