336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.
package com.tistory.tansanc.Test130805; import android.app.Activity; import android.content.Context; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.os.Bundle; import android.os.Vibrator; import android.view.View; import android.widget.Button; import android.widget.LinearLayout; public class MainActivity extends Activity { Vibrator mVib; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); LinearLayout linear = new LinearLayout(this); linear.setOrientation(LinearLayout.VERTICAL); linear.setBackgroundColor(Color.LTGRAY); Button button = new Button(this); button.setText("Test Button"); linear.addView(button); LinearLayout ll1 = (LinearLayout)View.inflate(this, R.layout.testlayout, null); linear.addView(ll1); MyView view = new MyView(this); linear.addView(view); setContentView(linear); } protected void onDestroy() { super.onDestroy(); mVib.cancel(); } } class MyView extends View { public MyView(Context context) { super(context); } public void onDraw(Canvas canvas) { Paint pnt = new Paint(); pnt.setColor(Color.BLUE); canvas.drawColor(Color.WHITE); canvas.drawCircle(100, 100, 80, pnt); } }
testlayout.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/ll1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="button 01" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="button 02" />
</LinearLayout>
'Programming > Android' 카테고리의 다른 글
Android 전화번호부 목록 ListView에 띄우기 (0) | 2013.08.09 |
---|---|
안드로이드 타자 연습 예제 (0) | 2013.08.08 |
Could not find .apk (0) | 2013.05.24 |
앱 시작 액티비티 변경 (0) | 2013.05.18 |
Android SQLite Select Where And & (0) | 2013.05.17 |