안녕하세요 안드로이드 강좌를 시작하게된 Shin 입니다.
res/layout/activity_main.xml
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <textview android:id="@+id/calculator" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/hello_world" android:textappearance="?android:attr/textAppearanceLarge"> </textview> </linearlayout>
자바파일 내용은~
public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } }
이렇게만 수정해도 hello world 가 찍히네요
LinearLayout 은 좌에서 우 , 위에서 아래로 추가되는 틀이 만들어집니다.
기본으로 위에서 아래로 됩니다.
만약 명시적으로 지정하시고 싶으시면 android:orientation 속성으로 지정하시면 됩니다. 값은 vertical , horizontal 이 있습니다.
horizontal 은 좌에서 우로 vertical 은 위에서 아래로입니다.
그럼 실행해볼까요?
우선 휴대폰을 셋팅합니다~
설정 > 개발자옵션 > 개발자옵션 ON > USB디버깅 켜기 > USB디버깅 허용 확인
설정이 끝났다면 실행을 합니다.
프로젝트를 선택하고 Run As > Android Application 을 선택합니다.
위에설정을 하고 usb연결을 해두었다면 아래와 같이 단말이 보입니다.
실행결과 화면 ~
예제 프로젝트입니다.
'안드로이드' 카테고리의 다른 글
[안드로이드 강좌 예제 따라하기 4] 계산기만들기 - 틀만들기(1/2) (2) | 2014.11.04 |
---|---|
[안드로이드 강좌 예제 따라하기 3] 액티비티 전환 다른액티비티 실행 (0) | 2014.11.04 |
[안드로이드 강좌 예제 따라하기 2] 기존 프로젝트 불러오기 (0) | 2014.11.04 |
티스토리 블로그 자바소스 코드 넣기 (0) | 2014.11.02 |
구글플레이 인증오류 해결법 (0) | 2014.02.07 |