목록Android Studio (9)
기루 기룩 기록

Activity.java 파일의 onCreate 부분에 아래의 코드를 추가해주면 됩니다. getWindow().setWindowAnimations(0);//화면 전환 애니메이션 제가

이번 시간에는 동영상 파일을 출력하는것을 알아보겠습니다. 필요한 준비물 - test용 mp4 파일 - 시간 activity_test.xml 파일에 VideoView 태그를 사용해 비디오가 들어갈 영역을 만들어 주겠습니다. id를 testVideo로 해서 입력해주세요. app - res안에 raw 폴더를 생성 후 준비물로 챙겨온 test.mp4 파일을 넣어주세요. Test.java에 다음과 같이 작성해 주세요. 실행 화면입니다.

android:maxHeight: 최대 높이 android:maxWidth: 최대 폭 android:src: 출력할 이미지 android:background: 배경

New Activity 생성하기 app - 마우스 우클릭 - New - Activity - Empty Activity 클릭 Activity Name을 설정해 주고 Finish 버튼을 클릭하도록 합니다. mainLayout와 생성된 Layout을 다음과 같이 만들어주세요 activity_main.xml에는 버튼을 만들어 id를 "@+id/moveButton" 으로 작성해 주세요. MainActivity.java를 열어 다음과 같이 작성해주세요. findViewById를 사용해 activity_main.xml에 있는 moveButton을 불러오겠습니다. 아래와 같이 작성해 activity_main.xml에 있는 moveButton에 새로운 액티비티로 이동할 수 있도록 만들어 주겠습니다. moveButton...

- 버튼 생성하는 2가지 방법 1.activity_main.xml 에서 아래 코드처럼 Text에 직접 Button을 생성하기 2. Design에서 Common - Button을 끌어다 생성하기 - 버튼 클릭 이벤트 추가하기 버튼을 생성한 후 속성에 Android:onClick("")를 통해 클릭 시 실행할 이벤트를 추가할 수 있습니다. 이번 글에서는 클릭 시 메시지를 띄어주는 이벤트를 추가해 보겠습니다. 우선 버튼 코드에 Android:onClick("btnClick")를 작성해 줍니다. 처음 작성 시 빨간 줄이 뜨는데 이는 btnClick라는 이벤트가 생성돼 있지 않아서 나타나는 오류입니다. 우선 넘어가셔도 괜찮습니다. MainActivity.java 파일을 열어 onCreate( ) 함수 및에 btn..