2010년 8월 2일 월요일

TextView의 텍스트 간격 넓히기(자간 간격)

android:lineSpacingExtra  : 라인의 간격을 더하기로 계산 Text의 height + LineSpacing
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.

[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.

2010년 7월 13일 화요일

Logcat 콘솔 출력시 한글 나타나게 하는 법

1. cmd 실행
2. cmd /u
3. chcp 65001
4. 속성 -> 글꼴 -> Lucida Console 변경
5. adb logcat 실행

2010년 5월 25일 화요일

중간 Activity 날리기

1depth : A, D
2depth : B
3depth : C

일 때

1) A -> B -> C -> D
2) D에서 back키 입력하면 B,C 가 사라지고 A가 나타난다.

(1)  B 에서 C로 이동 시
B에서는
- startActivityForResult(intent, 1);
- onActivityResult 구현

protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if(resultCode==RESULT_OK){
if( requestCode == 1){
finish();
}else if( requestCode == 2){
   // 다른 Activity로 이동
   startActivity();
  }
}
}

(2) C에서 D로 이동시 startActivity 전에
Intent previousIntent = getIntent();

setResult(RESULT_OK, previousIntent);

2010년 5월 19일 수요일

Activity 화면 전환 고정

Manifest.xml 파일에 적용

- Landscape 고정
<android:screenOrientation="landscape">

-Portrait 고정
<android:screenOrientation="portrait">

2010년 5월 12일 수요일

Activity Kill Process

1.메니페스트 파일에 RESTART_PACKAGES 권한을 사용한다고 선언한다.
<uses-permission android:name="android.permission.RESTART_PACKAGES"/>

2.ActivityManager 의 restartPackage API 를 호출한다.
ActivityManager am = (ActivityManager)getSystemService(ACTIVITY_SERVICE);
am.restartPackage(getPackageName());

2010년 5월 10일 월요일

A 어플에서 B 어플의 C-2 Activity 실행시키기

[A 어플]

Intent intent = new Intent();
intent.setClassName("android.com.test", "android.com.test.TestActivity");
startActivity(intent);

setClassName("패키지이름", "패키지이름.클래스이름");


-----------------------------------------------


[B 어플]
B-1(main App)
B-2(Sub App)
B 어플의 Manifest.xml 내용에

<activity android:name=".TestActiviActivity" android:label="@string/app_name1">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
</intent-filter>
</activity>

B 어플의 메인 Activity인 B-1은 A어플에서 바로 startActivity로 호출되어 실행되지만, B-2의 어플에 대해서는 manifest.xml 에 위와 같이 intent filter를 적용해야 한다.

2010년 5월 7일 금요일

Text 흘러가기


android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:ellipsize="marquee"
android:focusable="true"
android:focusableInTouchMode="true"
android:text="TEST1TEST2TEST3TEST4TEST5TEST6TEST7TEST8TEST9TEST10TEST11TEST12"


android:singleLine="true"
android:ellipsize="marquee"
android:focusable="true"
android:focusableInTouchMode="true"

위의 xml 속성이 포인트

글씨가 왼쪽으로 흐르는 것처럼 보인다