开发者

creating a countdowntimer

I've created a countdown timer that counts Days:Hrs:Mins:Sec. using regular text view and updating it using my handler works fine for me. however I want to create a cool animation for the changing digits: 1st Q:

I have 2 options as I see it to draw the numbers: 1. using a home made font applied with a style 2. using a textview/btn with no text on them and applying a backrgound image using setBackgroundResource()

--what should I choose?

2nd Q:

I've created a wrapper for ViewFlipper(not extending it)

public class transitionair extends Activity {
  SpecialFlipperWrapper m_thousand; 
  SpecialFlipperWrapper m_hundred; 
  SpecialFlipperWrapper m_tens; 
  SpecialFlipperWrapper m_ones; 
  @Override 
  public void onCreate(Bundle icicle) { 
    super.onCreate(icicle); 
    setContentView(R.layout.main);      

    ViewFlipper flipper_Tsnds=(ViewFlipper)findViewById(R.id.yearThousand);         
    m_thousand = new SpecialFlipperWrapper(flipper_Tsnds, this, 9); 

    ViewFlipper flipper_Hndrds=(ViewFlipper)findViewById(R.id.yearHundread);        
    m_hundred = new SpecialFlipperWrapper(flipper_Hndrds, this, 9);

    ViewFlipper flipper_Tns=(ViewFlipper)findViewB开发者_开发问答yId(R.id.yearTens);       
    m_tens = new SpecialFlipperWrapper(flipper_Tns, this, 9);       

    ViewFlipper flipper_Ons=(ViewFlipper)findViewById(R.id.yearOnes);       

    m_ones = new SpecialFlipperWrapper(flipper_Ons, this, 9);
    m_thousand.startFlipping(); 
    m_hundred.startFlipping();
    m_tens.startFlipping();
    m_ones.startFlipping();     

} }

however trying to fetch one of the latter views that come after the yearThousand id are retrieving null

XML I'm Using is:

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    > 
   <ViewFlipper
       android:id="@+id/yearThousand"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content" />
   <ViewFlipper
        android:id="@+id/yearHundread"
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" />
    <ViewFlipper 
        android:id="@+id/yearTens"
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" />
    <ViewFlipper
        android:id="@+id/yearOnes"
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" /> 
 </LinearLayout> 

ps xml's for the animation itself are working so I left them out

Main questions is: can I make it better? second question is: how? third question is why is my layout returning null on the second call to it and how can I avoid it?

10XX

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜