android theme 사용하기 Android


안드로이드 테마에 조금 실망이다. activity에 적용하는 style 이상도 이하도 아니네.

http://underclub.tistory.com/296

http://underclub.tistory.com/332

layout 구조까지 통째로 바꾸는 것은 아예 당연히 안되고.

적어도, theme을 바꿔서 style set이 바뀌기를 기대했는데..

이것까지는 되나보다. 방법은 여기: http://stackoverflow.com/questions/3241729/android-dynamically-change-style-at-runtime


  1. attrs.xml 에 선언
  2. styles.xml 에 styles 구현
  3. themes.xml 에 theme 정의, 연결.
  4. strings.xml, dimens.xml 등도 물론 사용할 것.


http://developer.android.com/guide/topics/ui/themes.html

틀리기 쉬운 것들

android theme은 @android:style

<activityandroid:theme="@android:style/Theme.Translucent">

custom theme은 @style

<activityandroid:theme="@style/CustomTheme">

적용했는데, 실행할 때 layout에 width가 없다고 죽는 경우에

java.lang.RuntimeException: Binary XML file line #12: You must supply a layout_width attribute.

theme 이하에 style이 존재하지 않아서 그럴 수도 있다.




android dialog 바깥쪽에 검정색 배경이 보일 때, 투명하게 만들기 Android



 getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));


windows에 연결한 프린터를 mac으로 network 공유 아직 실패 Mac


아직 실패했고, 보류 중.





ubuntu 11.10 에서 multi booting


grub 을 잘 쓰고 있었던 것 같은데,
오랜만에
ubuntu 11.10으로 update를 했더니,

default booting을 ubuntu로 한다.

ubuntu에
grub은 남아 있지 않고,
대신 StartUp-Manager 라는 프로그램이 있다.
그런데, 여기서 설정을 바꿔줘도 적용이 안된다.
즉,
http://askubuntu.com/questions/65890/does-startup-manager-work-in-11-10
와 같은 문제가 있다.

여기서 추천하는대로
http://shuffleos.com/2811/grub-customizer-customize-grub2-burg-settings/
대로 하고서,

목록에서 windows item 순서를 위로 올렸더니, windows를 default로 만들 수 있었다.





android 여러 성격 target 동시 개발 Computers



여러 size screen 을 한 번에 지원하기




resource를 활용하기



android용을 여러 프로젝트로 구성하기
에 대한 정석 설명.

만약에 ant 같은 것을 쓰려면, command line build를 할 줄 알아야겠다.






문제가 있다.

screenSize 를 api level 9 부터 지원하네.
android 2.2는 api level 8 이다.


public static final int screenSize

Since: API Level 9

Specifies a compatible screen size, as per the device configuration screen size bins.

Must be one of the following constant values.

ConstantValueDescription
small200A small screen configuration, at least 240x320db.
normal300A normal screen configuration, at least 320x480db.
large400A large screen configuration, at least 400x530db.
xlarge500An extra large screen configuration, at least 600x800db.

Constant Value: 16843466 (0x010102ca)

syntax:
<compatible-screens>
   
<screen android:screenSize=["small" | "normal" | "large" | "xlarge"]
           
android:screenDensity=["ldpi" | "mdpi" | "hdpi" | "xhdpi"] />
    ...
</compatible-screens>

...
introduced in:
API Level 9

어라 이상하다..

그런데, resource에서는 쓸 수 있나보다. api level 4 래. -0-

Screen sizesmall
normal
large
xlarge
  • small: Screens that are of similar size to a low-density QVGA screen. The minimum layout size for a small screen is approximately 320x426 dp units. Examples are QVGA low density and VGA high density.
  • normal: Screens that are of similar size to a medium-density HVGA screen. The minimum layout size for a normal screen is approximately 320x470 dp units. Examples of such screens a WQVGA low density, HVGA medium density, WVGA high density.
  • large: Screens that are of similar size to a medium-density VGA screen. The minimum layout size for a large screen is approximately 480x640 dp units. Examples are VGA and WVGA medium density screens.
  • xlarge: Screens that are considerably larger than the traditional medium-density HVGA screen. The minimum layout size for an xlarge screen is approximately 720x960 dp units. In most cases, devices with extra large screens would be too large to carry in a pocket and would most likely be tablet-style devices. Added in API level 9.

Note: Using a size qualifier does not imply that the resources are only for screens of that size. If you do not provide alternative resources with qualifiers that better match the current device configuration, the system may use whichever resources are the best match.

Caution: If all your resources use a size qualifier that is larger than the current screen, the system will not use them and your application will crash at runtime (for example, if all layout resources are tagged with the xlargequalifier, but the device is a normal-size screen).

Added in API level 4.

See Supporting Multiple Screens for more information.

Also see the screenLayout configuration field, which indicates whether the screen is small, normal, or large.



public int screenLayout

Since: API Level 4

Bit mask of overall layout of the screen. Currently there are two fields:

The SCREENLAYOUT_SIZE_MASK bits define the overall size of the screen. They may be one of SCREENLAYOUT_SIZE_SMALLSCREENLAYOUT_SIZE_NORMAL,SCREENLAYOUT_SIZE_LARGE, or SCREENLAYOUT_SIZE_XLARGE.

The SCREENLAYOUT_LONG_MASK defines whether the screen is wider/taller than normal. They may be one of SCREENLAYOUT_LONG_NO orSCREENLAYOUT_LONG_YES.

See Supporting Multiple Screens for more information.


좀 더 자세히 알아보니

Configuration config = getResources().getConfiguration();
config.screenLayout | android.content.res.Configuration.SCREENLAYOUT_SIZE_LARGE

과 같은 방식으로 값을 얻어낼 수 있기는 한데,

public static final int SCREENLAYOUT_SIZE_LARGE

Since: API Level 4

Constant for screenLayout: a SCREENLAYOUT_SIZE_MASK value indicating the screen is at least approximately 480x640 dp units. See Supporting Multiple Screensfor more information.

Constant Value: 3 (0x00000003)

까지만 API level 4 에서 지원되고, 이것도 이미 해상도 기준으로 정해지는 size 인가보다.
xlarge는 API level 9 에서 들어왔다.

별로 쓸모가 없겠다.



1 2 3 4 5 6 7 8 9 10 다음


메모장 실험

메모장도 로그가 남나 실험