Skip to content

Instantly share code, notes, and snippets.

View agiletalk's full-sized avatar

chanju Jeon agiletalk

View GitHub Profile
@agiletalk
agiletalk / PaintTest.java
Created April 27, 2011 06:39
[예제] Paint 속성들
public void onDraw(Canvas canvas) {
Paint Pnt = new Paint();
canvas.drawColor(Color.WHITE);
// 캡 모양 테스트
Pnt.setColor(Color.BLUE);
Pnt.setStrokeWidth(4);
canvas.drawLine(10,10,200,10,Pnt);
Pnt.setStrokeCap(Paint.Cap.ROUND);
canvas.drawLine(10,30,200,30,Pnt);
@agiletalk
agiletalk / Primitive2.java
Created April 27, 2011 05:33
[예제] Canvas draw- 메서드 more
public void onDraw(Canvas canvas) {
Paint Pnt = new Paint();
//canvas.drawARGB(255, 255, 255, 255);
//canvas.drawRGB(255, 255, 255);
//canvas.drawColor(0xffffffff);
Pnt.setColor(Color.WHITE);
canvas.drawPaint(Pnt);
RectF r = new RectF(10,10,100,100);
Pnt.setColor(Color.YELLOW);
canvas.drawRoundRect(r,10,10,Pnt);
@agiletalk
agiletalk / Primitive1.java
Created April 27, 2011 05:14
[예제] Canvas draw- 메서드
public void onDraw(Canvas canvas) {
Paint Pnt = new Paint();
canvas.drawColor(Color.WHITE);
canvas.drawPoint(10, 10, Pnt);
Pnt.setColor(Color.BLUE);
canvas.drawLine(20, 10, 200, 50, Pnt);
Pnt.setColor(Color.RED);
canvas.drawCircle(100, 90, 50, Pnt);
Pnt.setColor(0x800000ff);
canvas.drawRect(10,100,200,170,Pnt);
@agiletalk
agiletalk / CustomView.java
Created April 27, 2011 03:04
[예제] 간단한 커스텀 위젯
public class CustomView extends Activity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
MyView vw = new MyView(this);
setContentView(vw);
}
protected class MyView extends View {
public MyView(Context context) {
super(context);
@agiletalk
agiletalk / disable 'scrollToTop' property on all subviews
Created April 26, 2011 06:36
disableScrollToTopPropertyOnAllSubViewsOf.m
// for UIScrollView
- (void)disableScrollToTopPropertyOnAllSubViewsOf:(UIView *)view {
for(UIView *subview in view.subviews) {
if([subview isKindOfClass:[UIScrollView class]]) {
((UIScrollView *) subview).scrollsToTop = NO;
}
[self disableScrollToTopPropertyOnAllSubViewsOf:subview];
}
}
@agiletalk
agiletalk / TwoTables.m
Created April 21, 2011 05:24
Two UITableView in One UIViewController
#pragma mark -
#pragma mark Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
NSInteger rows;
@agiletalk
agiletalk / com.c
Created April 17, 2011 17:05
Co-occurrence matrix of a binary data (DIPS Homework #3.)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define BUFFER 128
int main(int argc, char* argv[])
{
char buf[BUFFER];
char* ptr;
@agiletalk
agiletalk / CodeLayout.java
Created April 13, 2011 10:44
[예제] 실행 중에 속성 바꾸기
package org.catchabug.LayoutGravityTest;
import android.app.Activity;
import android.os.Bundle;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
public class LayoutGravityTest extends Activity {
/** Called when the activity is first created. */
@agiletalk
agiletalk / table.xml
Created April 13, 2011 10:24
[예제] TableLayout
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<TableRow>
<TextView android:text="국어" android:textSize="15pt" android:padding="10px" />
<TextView android:text="영어" android:textSize="15pt" android:padding="10px" />
<TextView android:text="수학" android:textSize="15pt" android:padding="10px" />
@agiletalk
agiletalk / Frame.java
Created April 13, 2011 09:35
[예제] FrameLayout
package org.catchabug.FrameLayout;
import android.app.*;
import android.os.*;
import android.util.Log;
import android.view.*;
import android.widget.*;
public class Frame extends Activity {
public void onCreate(Bundle savedInstanceState) {