*Adding to what I wrote on DatePicker, let me share with you the code I
wrote. Somehow, when I try to render it using setContentView , all I am
getting is a blank screen( no exceptions at all). *
*I am just clueless.. :-*
*public** class** myDatePicker extends** DatePicker {*
**
*public** myDatePicker(Context context) {*
*super**(context);*
*onFinishInflate();*
*setFocusable(**true**);*
*}*
*
public** myDatePicker(Context c, AttributeSet attr){*
*super**(c,attr);*
*onFinishInflate();*
*setFocusable(**true**);*
*}*
*
public** myDatePicker(Context c, AttributeSet attrs, int** defaultStyle){*
*super**(c, attrs, defaultStyle);*
*onFinishInflate();*
*setFocusable(**true**);*
*}*
*...@override*
*public** void** onDraw( Canvas c){*
*super**.onDraw(c);*
*}*
*}*
**
**
*...@override*
*protected** void** onMeasure(int** x, int** y){*
**
**
*int** width = measure(x);*
*int** height = measure(y);*
*int** getMin = Math.min(width, height);*
*//int setMax = getMin/2 ;*
*setMeasuredDimension(getMin, getMin); *
*}*
**
*private** int** measure(int** specs) {*
*// TODO** Auto-generated method stub*
**
*int** result =0;*
*int** specMode = MeasureSpec.getMode(specs);*
*int** specSize = MeasureSpec.getSize(specs);*
*if** ( specMode == MeasureSpec.UNSPECIFIED**)*
*result=100;*
*else
*
*result = specSize;*
*return** result;*
* }*
*}*
*This my Activity class which renders my DatePicker:-. Note that I am not
getting widget Id from the resouce file but directly rendering it within my
code*. * when I use the resouce file or add this widget to my main.xml, I
still see no change...*
*public** class** toDoEdit extends** Activity {*
*...@override*
*public** void** onCreate(Bundle bundle){*
*super**.onCreate(bundle);*
*setContentView(R.layout.**todo_edit);
*
*myDatePicker dp = **new** myDatePicker(this**);*
*setContentView(dp);*
*dp.setEnabled(**true**);*
*}*
On Sun, Mar 7, 2010 at 1:54 PM, sunny <[email protected]> wrote:
> Hi All,
>
> Can someone guide me on datePicker widget. I want to reduce the dimensions
> of it within my relative layout. The goal is to reduce the size of its frame
> along with its child widgets such as the day, month and year. How can do it.
>
>
> I would greatly appreciate your quick response and wisdom here..
>
> thanks
> Sunny.
>
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en