학습/공통,미분류

안드로이드 자주쓰는 코드

roquen4145 2018. 7. 30. 00:15


* onClickListener 만들기


TextView sampleTextView;


sampleTextView = (TextView) findViewById(R.id.textview_id);  // 주로 onCreate 함수 안에 선언


sampleTextView.setOnClickListener(new View.OnClickListener(){

@Override

public void onClick( View v) {

  // Click 했을 때 작업

}

});








* LinearLayout 기본 골격


<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

    xmlns:app="http://schemas.android.com/apk/res-auto"

    android:layout_width="match_parent"

    android:layout_height="match_parent"

    android:orientation="vertical"

    android:background="@color/color_ffffff" >


</LinearLayout>



* Layout 내 컨텐츠 정렬


android:gravity="center" // 레이아웃에 추가 , top, bottom , left, right, center_horizontal, center_vertical 등

반응형

'학습 > 공통,미분류' 카테고리의 다른 글

Intro  (0) 2022.02.16
Vagrant Study  (0) 2021.05.10
R 프로그래밍 piglatin  (0) 2017.04.04
R 프로그래밍 데이터프레임 만들기  (0) 2017.03.30
프로그래밍 공부하기 좋은 소스들  (1) 2017.03.25