2010년 11월 19일 금요일
TextView 한글의 Bold 처리
text.setText("한글 볼드 테스트");
text.setPaintFlags(text.getPaintFlags() | Paint.FAKE_BOLD_TEXT_FLAG);
2010년 11월 11일 목요일
단말의 DIP, WIDTH, HEIGHT 값 구하기
DisplayMetrics displaymetrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
density = displaymetrics.densityDpi;
width = displaymetrics.widthPixels;
height = displaymetrics.heightPixels;
getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
density = displaymetrics.densityDpi;
width = displaymetrics.widthPixels;
height = displaymetrics.heightPixels;
2010년 11월 1일 월요일
Bitmap <--> Drawable
[Bitmap to Drawable]
BitmapDrawable bitmapDrawable = (BitmapDrawable)bitmap;
Drawable drawable = (Drawable)bitmapDrawable;
Bitmap bitmap = new Bitmap (...);
Drawable drawable = new BitmapDrawable(bitmap);
[Drawable to Bitmap]
Bitmap bitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
d.setBounds(0, 0, w, h);
d.draw(canvas);
BitmapDrawable bitmapDrawable = (BitmapDrawable)bitmap;
Drawable drawable = (Drawable)bitmapDrawable;
Bitmap bitmap = new Bitmap (...);
Drawable drawable = new BitmapDrawable(bitmap);
[Drawable to Bitmap]
Bitmap bitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
d.setBounds(0, 0, w, h);
d.draw(canvas);
2010년 10월 22일 금요일
tile background 방법
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:id="@+id/MainLayout"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="@drawable/backrepeat">
/res/drawable/backrepeat.xml 생성한다.
<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/back"
android:tileMode="repeat" />
<LinearLayout
android:id="@+id/MainLayout"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="@drawable/backrepeat">
/res/drawable/backrepeat.xml 생성한다.
<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/back"
android:tileMode="repeat" />
2010년 10월 13일 수요일
스크롤 관련
1. 스크롤 버튼 : setFastScrollEnabled(true)
2. 스크롤 할때만 나타나게 하기 : android:fadeScrollbars="true"
3. 스크롤 이미지 변경
android:scrollbarThumbVertical="@drawable/..."
android:scrollbarThumbHorizontal="@drawable/..."
4. 스크롤의 background
android:scrollbarTrackVertical="@drawable/..."
android:scrollbarTrackHorizontal="@drawable/..."
2. 스크롤 할때만 나타나게 하기 : android:fadeScrollbars="true"
3. 스크롤 이미지 변경
android:scrollbarThumbVertical="@drawable/..."
android:scrollbarThumbHorizontal="@drawable/..."
4. 스크롤의 background
android:scrollbarTrackVertical="@drawable/..."
android:scrollbarTrackHorizontal="@drawable/..."
2010년 8월 2일 월요일
TextView의 텍스트 간격 넓히기(자간 간격)
android:lineSpacingExtra : 라인의 간격을 더하기로 계산 Text의 height + LineSpacing
android:lineSpacingMultiplier : 라인의 간격을 곱하기로 계산 Text의 height * LineSpacing
[android:lineSpacingExtra]
Extra spacing between lines of text.
[android:lineSpacingMultiplier]
Extra spacing between lines of text, as a multiplier.
android:lineSpacingMultiplier : 라인의 간격을 곱하기로 계산 Text의 height * LineSpacing
[android:lineSpacingExtra]
Extra spacing between lines of text.
Must be a dimension value, which is a floating point number appended with a unit such as "
14.5sp". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters).This may also be a reference to a resource (in the form "
@[package:]type:name") or theme attribute (in the form "?[package:][type:]name") containing a value of this type.This corresponds to the global attribute resource symbol
lineSpacingExtra.Related Methods
[android:lineSpacingMultiplier]
Extra spacing between lines of text, as a multiplier.
Must be a floating point value, such as "
1.2".This may also be a reference to a resource (in the form "
@[package:]type:name") or theme attribute (in the form "?[package:][type:]name") containing a value of this type.This corresponds to the global attribute resource symbol
lineSpacingMultiplier.Related Methods
피드 구독하기:
글 (Atom)