Wednesday, March 18, 2009

Marquee feature of TextView in Android 1.1R1

In the newest release, Android 1.1 R1, android.widget.TextView begins to support marquee feature.
It provides a value, marquee, for android:ellipsize, and a new attribute, android:marqueeRepeatLimit.

However you could not make the TextView scrolling if you only set these 2 attributes.
According to my testing, at least the following 3 attributes shall be set:
And the TextView shall be focused while running.

Moreover, I found 2 limitations in current marquee implementation:
  1. Never scroll if the TextView does not get the focuse;
  2. The scrolling is odd because the round of scrolling begins from the left side while end at the right side. It looks like the animation is reset.
So far, I think my implementation of ScrollTextView is better for the marquee feature. :)

Wednesday, March 11, 2009

Browse Android Java source codes online

Sometimes, it's necessary for developer to check the implementation of an API when the SDK documentation is not enough for understanding.
However, Android source codes are approximately 2.1G in size. It's not handy to download and browse them in local PC.
Fortunately, supports GitWeb for web browsing of the source codes though it's not intuitive to find out which git ball the java code is in.
Some guy find out the path. It is
[platform/frameworks/base.git] / core / java /

Wednesday, March 4, 2009

Technical Key Points of Androidmine Project

Here are the techincal key points I learned from the open source project, androidmine.
Its current version is 0.7.

1. Customize the activity theme (window without title)
<activity android:name=".Main" android:theme="@style/Theme.Game">
<style name="Theme.Game">
<item name="android:windowNoTitle">true</item>

2. Set the conent view for the activity
Use view) to set the activity content to an explicit view. This view is placed directly into the activity's view hierarchy. It can itself be a complex view hierarhcy. By this way, you can switch any view you want to show.
Overwrite onLayout, onDraw to customize the view
Overwrite onKeyUp, onKeyDown and onTouchEvent to handle the user input
Call invalidate in the UI thread, or postInvalidate in the non-UI thread to make the onDraw called

3. Use android.os.Handler to send and handle messages, schedule an action in the feature

4. Use to play background music in a separated thread