开发者

dots in the viewFlipper view

I have a ViewFlipper view with two views inside it -

        <ListView 
            android:dividerHeight="5dip" 
            android:id="@android:id/list" 
            android:layout_height="fill_parent" 
            android:layout_width="fill_parent" 
            android:drawSelectorOnTop="false" 
            android:divider="@android:color/black">
        </ListView>

        <TextView 
            android:layout_height="fill_parent" 
            android:layout_gravity="bottom" 
            android:id="@+id/textView1" 
            android:layout_width="fill_parent">
        </TextView>                     
开发者_StackOverflow社区    </ViewFlipper>

How do i programmtically DRAW two little dots (or as many dots as there are children views inside the viewFlipper view)?

Should i override onDraw()?

My activity that inflates this ViewFlipper layout extends ListActivity...

Thanks.


Consider overriding dispatchDraw method (invoke super method and after that draw dots) because if you override onDraw the children's content will cover your dots.

Or create extension of horizontal linear layout containing view flipper at the top and some component at the bottom which manages ImageViews to show dots (or draws them manually).

public class CustomViewFlipper extends ViewFlipper {
     public TableLayout(Context context, AttributeSet attrs) {
       super(context, attrs);
     }

     @Override
     protected void dispatchDraw(Canvas canvas) {
       super.dispatchDraw(canvas);

       drawDots(canvas);
     } 
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜