'2009/05'에 해당되는 글 13건

  1. 2009/05/31 남산 (2)
  2. 2009/05/26 Android - MimeType으로 image얻어오기 (3)
  3. 2009/05/23 추억이면 - 부활 (1)
  4. 2009/05/21 Android - Change Tab Background
  5. 2009/05/21 Android - Shape XML Examples
  6. 2009/05/20 Android - TabWidget의 background 변경
  7. 2009/05/20 XLFD (2)
  8. 2009/05/19 내조의여왕에 무한도전 맴버 ㅋㅋ (2)
  9. 2009/05/19 미쿡에서... (3)
  10. 2009/05/19 Android - Updating UI On UI Thread

남산

추억쌓기 2009/05/31 12:03
원래는 부천에 아인스월드 갈려구 했는데
늦게 일어나는바람에 장소를 변경했다.

대한극장에서 로즈가든에서 사진찍어 올리면 상품준다는 소식에
가서 사진을 찍으러 갔는데 -ㅅ-
영 사진찍을 만한 분위기가 아니라서 남산으로 향했다

날씨가 꾸리꾸리해서 아쉬움 ㅜㅜ







저작자 표시 비영리 변경 금지
Posted by 유야

댓글을 달아 주세요

  1. BlogIcon Chan 2009/06/02 14:26  댓글주소  수정/삭제  댓글쓰기

    아웃포커싱 짱~ ㅎㅎ

  2. BlogIcon 생글이 2009/07/01 12:39  댓글주소  수정/삭제  댓글쓰기

    열쇠를 왜 달아둔건데? ㅋㅋ

Android에 번들되어있는 Browser 소스 뒤져보다가 발견한 부분
정확히 mimeType에 해당하는 이미지는 아니고 mimeType을 열수 있는 Application에서 제공하는 이미지를
얻어오는듯 하다(소스를 보아하니 -_-)

Intent intent = new Intent(Intent.ACTION_VIEW)
intent.setDataAndType(Uri.fromParts("file", "", null), mimeType);
PackageManager pm = context.getPackageManager();
List<ResolveInfo> list = pm.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
if (list.size() > 0) {
Drawable icon = list.get(0).activityInfo.loadIcon(pm);
}
저작자 표시 비영리 변경 금지
Posted by 유야

댓글을 달아 주세요

  1. BlogIcon Chan 2009/05/27 00:08  댓글주소  수정/삭제  댓글쓰기

    꺄~ 안드로이드 전문가~ ㅎㅎ

  2. BlogIcon 옷장수 2009/05/27 09:17  댓글주소  수정/삭제  댓글쓰기

    꺄~ 오타다. MineType 내타입은 음~ 이미지에요~ -,.-;; ㅋㅋ




추억이면 - 부활
10집 서정

정동하 목소리에 꽃혔음 -ㅅ-;;
음질의 압박 ㅜㅜ

저작자 표시 비영리 변경 금지
Posted by 유야

댓글을 달아 주세요

  1. BlogIcon 유겸애비 2009/05/23 08:28  댓글주소  수정/삭제  댓글쓰기

    전에 스키장 갔는데 정동하가 왔어요. 노래 잘한다는 가수들 여럿왔었는데도 눈에 띄더라구요

TabWidget에서 추가되는 Tab의 Background변경하기
Tab마다 View를 얻어와서 직접 BackgroundDrawable을 지정하고
아래 막대부분은 reflection을 이용하여 꽁수로 바꿔치기 한다

tab_indicator.xml, tab_bar_left.xml, tab_bar_right.xml 내용은 <selector>로 정의

    private void changeTabWidgetStyle(TabWidget tw){
        for (int i = 0; i < tw.getChildCount(); i++) {
            View v = tw.getChildAt(i);
            v.setBackgroundDrawable(getResources().getDrawable(R.drawable.tab_indicator));
        }
       
        Field mBottomLeftStrip;
        Field mBottomRightStrip;
        try {
            mBottomLeftStrip = tw.getClass().getDeclaredField("mBottomLeftStrip");
            mBottomRightStrip = tw.getClass().getDeclaredField("mBottomRightStrip");
           
            if(!mBottomLeftStrip.isAccessible()) {
                mBottomLeftStrip.setAccessible(true);
            }
            if(!mBottomRightStrip.isAccessible()){
                mBottomRightStrip.setAccessible(true);
            }
            mBottomLeftStrip.set(tw, getResources().getDrawable(R.drawable.tab_bar_left));
            mBottomRightStrip.set(tw, getResources().getDrawable(R.drawable.tab_bar_right));
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

tab_indicator.xml 예
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <!-- Non focused states -->
    <item android:state_focused="false"
        android:state_selected="false"
        android:state_pressed="false"
        android:drawable="@drawable/tab_unselected" />
    <item android:state_focused="false"
        android:state_selected="true"
        android:state_pressed="false"
        android:drawable="@drawable/tab_selected" />

    <!-- Focused states -->
    <item android:state_focused="true"
        android:state_selected="false"
        android:state_pressed="false"
        android:drawable="@drawable/tab_focus" />
    <item android:state_focused="true"
        android:state_selected="true"
        android:state_pressed="false"
        android:drawable="@drawable/tab_focus" />

    <!-- Pressed -->
    <item android:state_pressed="true" android:drawable="@drawable/tab_press" />
</selector>

저작자 표시 비영리 변경 금지
Posted by 유야

댓글을 달아 주세요

1.  Linear Gradient
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <gradient android:startColor="#FFFF00" android:endColor="#FFFFFF" android:angle="270"/>
    <corners android:radius="0dp" />
</shape>


2. Radial Gradient
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
    <gradient android:type="radial"
        android:startColor="#ff0000"
        android:endColor="#ffff00"
        android:gradientRadius="300"
        android:centerX="0.5"
        android:centerY="0.7"/>
</shape>


3. Line
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="line">
    <stroke android:width="1dp" android:color="#FF000000"
            android:dashWidth="1dp" android:dashGap="2dp" />
    <size android:height="5dp" />
</shape>

4. Oval
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval">
    <solid android:color="#00000000"/>
    <stroke android:width="4dp" android:color="#990000FF"
            android:dashWidth="4dp" android:dashGap="2dp" />
    <padding android:left="7dp" android:top="7dp"
            android:right="7dp" android:bottom="7dp" />
    <corners android:radius="4dp" />
</shape>


5. Ring & Sweep Gradient
<shape android:shape="ring" xmlns:android="http://schemas.android.com/apk/res/android"
    android:innerRadiusRatio="3"
    android:thicknessRatio="8"
    android:useLevel="false">
    <size android:width="48dip"
        android:height="48dip" />
    <gradient android:type="sweep"
        android:useLevel="false"
        android:startColor="#4c737373"
        android:centerColor="#4c737373"
        android:centerY="0.50"
        android:endColor="#ffffd300" />
</shape>



저작자 표시 비영리 변경 금지
Posted by 유야

TAG android

댓글을 달아 주세요

http://developer.android.com/guide/tutorials/views/hello-tabwidget.html
위 링크의 TabWidget 예제로 이리저리 TabWidget의 background 변경해본 결과

먼저 background 로 쓸 drawable 파일 준비
일단 tabWidget의 background로 사용할 drawable 파일을 만들었다
물론 그냥 색상을 지정해도 상관없다 ㅋㅋ (걍 이런저런 기능 사용해보기위해)

res/drawable/tab_bg.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <gradient android:startColor="#FF0000" android:endColor="#C0C0C0"
            android:angle="0"/>
    <corners android:radius="0dp" />
</shape>

이제 이 background를 적용해 보았다

1. Theme로 적용
 styles.xml 만든다
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="Theme.Test" parent="android:Theme">
        <item name="android:tabWidgetStyle">@style/Widget.TabWidget</item>
    </style>
    <style name="Widget.TabWidget" parent="android:Widget.TabWidget">
         <item name="android:background">@drawable/tab_bg</item>
    </style>
</resources>

여기서 tabWidgetStyle은 모두 "Widget.TabWidget" style을 사용하도록 하고 background를 지정해 주었다
"Theme.Test"를 AndroidManifest.xml 에서 적용시킨다

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="net.escomic.test"
      android:versionCode="1"
      android:versionName="1.0">
    <application android:icon="@drawable/icon" android:label="@string/app_name"
        android:theme="@style/Theme.Test">
        <activity android:name=".Tab" 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>
    <uses-sdk android:minSdkVersion="3" />
</manifest>

이렇게 하면 결과는


글자에만 배경이 적용되었다 -_-;;;

2. TabWidget에 Style적용
테마로 적용한 경우 원하는 결과가 나오지 않아 TabWidget에 바로Widget.TabWidget Style을 적용해 보았다

AndroidMenifest.xml 에서 적용한 Theme는 삭제하고
layout 파일에서 style적용
<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@android:id/tabhost"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <LinearLayout
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">
        <TabWidget
            android:id="@android:id/tabs"
            style="@style/Widget.TabWidget"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content" />
        <FrameLayout
            android:id="@android:id/tabcontent"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent">
            <TextView
                android:id="@+id/textview1"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:text="this is a tab" />
            <TextView
                android:id="@+id/textview2"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:text="this is another tab" />
            <TextView
                android:id="@+id/textview3"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:text="this is a third tab" />
        </FrameLayout>
    </LinearLayout>
</TabHost>

style대신에 android:background="@style/tab_bg" 로 써도 된다
이렇게 하면 다음과 같다 -_-;;


이것은 소스 코드상에서 직접 설정하는것과 같다
TabHost mTabHost = getTabHost();
TabWidget tabWidget = mTabHost.getTabWidget();
tabWidget.setBackgroundResource(R.drawable.tab_bg);       

3. 따라서...
테마에  tabWidgetStyle 과 TabWidget에 직접 style을 적용하는 것이 다르다는 것을 알수있는데
왜인지는 모르겠따 -_-;;;



* 번외로 TabHost라고 있는데 여기에 background를 적용하면 아래와 같다
여기서 TabWidget에 background가 없으면 TabHost의 것이 적용되기때문에 노란색 그라데이션이 윗부분까지 적용되게 된다


* TAB1, TAB2, TAB3과 같은 Tab에 style을 적용하는 것은 없는 듯하다
따로 아예 만들어줘야 한다는듯... -_-;;;


저작자 표시 비영리 변경 금지
Posted by 유야

댓글을 달아 주세요

XLFD

지식쌓기 2009/05/20 12:03
XLFD = X Logical Font Description

리눅스에서 사용하는 폰트를 나타내는 방법으로
대시로 구분된 폰트의 속성들을 나열한 것으로 각 속성은 와일드 카드로 변경되어 runtime에 지정할수 있다
자세한 내용은 : http://www.meretrx.com/e93/docs/xlfd.html

형식 :
FontNameRegistry-Foundry-FamilyName-WeightName-Slant-SetwidthName
-AddStyleName-PixelSize-PointSize-ResolutionX-ResolutionY
-Spacing-AverageWidth-CharSetRegistry-CharSetCodin

예 :
-monotype-times new roman-regular-r---*-%d-*-*-p-*-iso8859-1


아래 명령어를 통해서 xlfd의 모든 리스트를 볼수 있다
xlsfonts [-options] [-fn pattern]

ex) xlsfonts -fn '-hy-*'

저작자 표시 비영리 변경 금지
Posted by 유야

TAG Linux, xlfd

댓글을 달아 주세요

  1. BlogIcon iolo 2009/05/21 00:50  댓글주소  수정/삭제  댓글쓰기

    요즘 리눅스는 저거 잘 안쓰는데...
    안드로이드는 아직 저거 쓰나보네...


ㅎㅎㅎㅎㅎㅎ
오늘 내조의 여왕 마지막회라 보고있는데
무한도전 맴버들 나왔다 ㅋㅋㅋ
면접보러 ㅋㅋㅋㅋ
(정준하는 안나옴)

근데 어째 유재석은 면접붙었네 ㅋㅋ

도메인 장애 있는 이후로 일일 방문자가
1/10 로 줄었따 ㅜㅜ
저작자 표시 비영리 변경 금지
Posted by 유야

댓글을 달아 주세요

  1. BlogIcon Chan 2009/05/20 02:03  댓글주소  수정/삭제  댓글쓰기

    박명수.. ㅎㅎ ..
    노홍철은 한 마디도 못했네. ㅋ

  2. 철호짱 2009/05/20 10:57  댓글주소  수정/삭제  댓글쓰기

    최철호씨..표정 진짜.. 웃기네요.. 아무리 봐도 게그멘 보다 더 웃겨..

미쿡에서...

추억쌓기 2009/05/19 22:23
귀차니즘에 의거한 뒷북 포스팅..
(또 언제 뒷북 포스팅이 올라올지 모름 -_- 하키랑.... )

지난 2월 출장때
한국 오기 전날 찍은 사진들..

Chapel Hill에 있는
North Carolina University랑
Franklin Street 랑

그외 공항이랑.. 기타 등등..
내가 안찍은거도 많음 -_-;























요건 찍어주신거 ㅎㅎ
내 카메라보다 훨 좋아요 ㅜㅜ





저작자 표시 비영리 변경 금지
Posted by 유야

댓글을 달아 주세요

  1. BlogIcon 실리콘벨리(임상범) 2009/05/20 00:01  댓글주소  수정/삭제  댓글쓰기

    미국 사진 잘 보고 갑니다.^^
    개인적으론 아직 여행을 자주 다니지 못했지만
    조금씩 떄론 여유도 갖으며 가족과 친구와 다양한 나라에
    여행을 다닐 수 있다면 좋겠습니다. 물론 떄로 비용도 많이 드는
    부분이 있겠지만 배낭여행(?)과 같은 것도 해보고 싶다는 생각이 드네요.^^

  2. BlogIcon 딸랑이 2009/07/01 12:40  댓글주소  수정/삭제  댓글쓰기

    와~ 구경하기도 바쁠텐데 저런건 언제 찍는거고 ㅋㅋㅋ
    부럽다 ㅋㅋ 미국도 가고 ㅋㅋ

Android에서도 UI관련 행위는 UI Thread위에서 해야한다
그렇지 않으면 아래와 같은 Exception이 발생한다

android.view.ViewRoot$CalledFromWrongThreadException: Only the original thread that created .....

Swing의 SwingUtilities.invokeLater(Runnable r)와 같은 역할을 하는 아래의 방법을 사용하여 해결할수 있다

Activity.runOnUiThread(Runnable action)

View.post(Runnable action)

View.postDelayed(Runnable action, long delayMillis)

Handler.post(Runnable action)

저작자 표시 비영리 변경 금지
Posted by 유야

TAG android

댓글을 달아 주세요