LANGUAGE/ANDROID 2015. 5. 4. 14:39

///////////////////////////////////////////////////////////////////////////

///////////////////////// 개요 /////////////////////////

///////////////////////////////////////////////////////////////////////////


///////////////////////////////////////////////////////////////////////////

///////////////////////// 개발 환경 /////////////////////////

///////////////////////////////////////////////////////////////////////////

///// 안드로이드 개발환경

JDK(Java Development Kit)

///// ECLIPSE - 이클립스(http://www.eclipse.org/)
-> EClipse설치()

-> Android Plugin 설치()

-> Android SDK(Standard Developmet Kit)

///// AVD(Android Virtual Device)



 


///////////////////////////////////////////////////////////////////////////

///////////////////////// 프로젝트 구조 /////////////////////////

///////////////////////////////////////////////////////////////////////////

///// projectname/

androidmanifest.xml - 프로젝트의 전체 속성과 권한 


///// projectname/src 

(소스파일) 

(기본으로 Activity를 상속하는 java파일 필요)


///// projectname/gen 

(SDK와 Dependencies)


///// projectname/assets - 원시 파일로 관리, 읽기 위해서는 ByteStream과 AssetManager클래스를 사용


///// projectname/bin 


///// projectname/res/anim  

(애니메이션 프레임, tweened되는 xml파일)


///// projectname/res/drawable  - 이미지 압축하여 자동 최적화 됨

(png or jpg파일)


///// projectname/res/layout

(레이아웃 관련 XML 파일)


///// projectname/res/values  

(리소스 관련 XML파일)

array.xml - 배열 정의   

colors.xml - 컬러 드뤄블 값과 컬러 문자열 값 정의 //자바에서 Resources.getDrawable()과  Resources.getColor()으로 호출

dimens.xml - 크기 값 정의 //자바에서 Resources.getDiensoion()으로 호출

string.xml -   //자바에서 Resources.getDimension() 또는 Resources.getText()으로 호출

styles.xml - 폰트 정의


///// projectname/res/xml    //자바에서 Resources.getXML()으로 호출


///// projectname/res/raw   //자바에서 Resources.getRawResource(R.raw.filename)으로 호출

(압축되지 않고 그대로 디바이스에 올라가는 파일들)



///// (기타 라이브러리들...)






///////////////////////////////////////////////////////////////////////////

///////////////////////// 소스 구조 /////////////////////////

///////////////////////////////////////////////////////////////////////////


////////////////////////////// AndroidManifest.xml 

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

<manifest 

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

package="com.book.game.min3d"

android:versionCode="1"

android:versionName="1.0" >


    <uses-sdk 

android:minSdkVersion="10" 

android:targetSdkVersion="17"/>


    <application

        android:icon="@drawable/ic_launcher"

        android:label="@string/app_name" >

        <activity

            android:name=".Min3DActivity"

            android:label="@string/app_name" >

            <intent-filter>

                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />

            </intent-filter>

        </activity>

    </application>


</manifest>




 

////////////////////////////// activity_main.xml

<!-- 레이아웃 종류 : AbsoluteLayout, LinearLayout, FrameLayout ,RelativeLayout, TableLayout -->

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

    xmlns:tools="http://schemas.android.com/tools"

    android:layout_width="match_parent"

    android:layout_height="match_parent"

    android:orientation="vertical"

    android:paddingLeft="@dimen/activity_horizontal_margin"

    android:paddingRight="@dimen/activity_horizontal_margin"

    android:paddingTop="@dimen/activity_vertical_margin"

    android:paddingBottom="@dimen/activity_vertical_margin"

    tools:context=".MainActivity">


    <TextView

        android:layout_width="match_parent"

        android:layout_height="70dp"

        android:text="텍스트뷰다"

        android:textSize="50dp"

        android:scaleType="fitXY"

        android:textIsSelectable="false" />


    <ImageView

        android:layout_width="match_parent"

        android:layout_height="50dp"

        android:src="@drawable/sun"

        android:scaleType="fitXY"/>


    <EditText

        android:layout_width="match_parent"

        android:layout_height="50dp"

        android:hint="Press Here"

        android:inputType="textMultiLine"

        android:maxLines="3"

        android:scrollbars="vertical"/>


    <Button

        android:id="@+id/btnExit"

        android:layout_width="match_parent"

        android:layout_height="50dp"

        android:text="남"

        android:textStyle="bold"

        android:textSize="24dp"

        android:gravity="center"

        android:layout_marginLeft="20dp"/>


    <RadioGroup

        android:id="@+id/rG1"

        android:layout_width="match_parent"

        android:layout_height="50dp"

        android:orientation="horizontal"

        android:background="#F5FA61"

        android:gravity="top"

        android:paddingLeft="1dp"

        android:paddingRight="1dp">

        <RadioButton

            android:id="@+id/rG1men"

            android:layout_width="match_parent"

            android:layout_height="50dp"

            android:layout_weight="1"

            android:text="남"

            android:textColor="#ff00ff"

            android:textStyle="bold"

            android:textSize="24dp"/>

        <RadioButton

            android:id="@+id/rG1women"

            android:layout_width="match_parent"

            android:layout_height="50dp"

            android:layout_weight="1"

            android:text="여"

            android:textColor="#ff00ff"

            android:textStyle="bold"

            android:textSize="24dp"/>

    </RadioGroup>


    <LinearLayout

        android:layout_width="match_parent"

        android:layout_height="match_parent"

        android:orientation="horizontal">

        <CheckBox

            android:layout_width="30dp"

            android:layout_height="30dp" />

        <CheckBox

            android:layout_width="30dp"

            android:layout_height="30dp" />

    </LinearLayout>


</LinearLayout>




////////////////////////////// style.xml

<style name="" parent="AppbasTheme">

<item name="android:typeface">monospace</item>

<item name="android:ttextColor">#00ff00</item> 

</style>



////////////////////////////// menu.xml
<menu xmlns:android="http://schemas.android.com/apk/res/adroid">

<item

android:id="@+id/menu1" 

android:title="메뉴1" 

android:icon="@drawable/menu1" 

android:showAsAction"always" />

<item

android:id="@+id/menu2" 

android:title="메뉴2" 

android:icon="@drawable/menu2" 

android:showAsAction"always" />

<item

android:id="@+id/menu3" 

android:title="메뉴3" 

android:icon="@drawable/menu3" 

android:showAsAction"always" />

</menu>


<TabHost> 

<TabWidget></TabWidget>  

<FrameLayout>

<AnalogClock /> 

<DigitalClock />

</FrameLayout>

</TabHost>


<Spinner />

 


////////////////////////////// MainActivity.java

public class MainActivity extends Activity{

protected void onCreate(Bundle saveInstanceState){

super.onCreate(savedInstanceState);   //기본

requestWindowFeature(Window.FEATURE_NO_TITLE);   //

getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);   //

setContentView(R.layout.activity_main);   //뷰 설정

}     


public boolean onCreateOptionsMenu(Menu menu){

getMenuInflater().inflate(R.menu.activity_main, menu)

return true;

}

}

'LANGUAGE > ANDROID' 카테고리의 다른 글

android 정리중  (0) 2015.05.04
OpenGL  (0) 2015.05.04