如何使TimePicker小 [英] How to make the TimePicker smaller

查看:91
本文介绍了如何使TimePicker小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能使默认TimePicker在活动XML小?我已搜查这一点,但迄今只发现了如何创建一个我不想做一个自定义的时间选择器,或者创建一个我也不想要做一个弹出窗口。有没有人试图与任何成功的?我TimePicker正坐在一个滚动视图通过t​​ablerow。干杯

Is it possible to make the default TimePicker smaller in the activity xml? I have searched this but so far only found out how to create a custom time picker which I do not want to do, or create a popup window which I also don't want to have to do. Has anyone tried this with any success? My TimePicker is sitting in a tableRow in a scrollView. Cheers

推荐答案

您不能改变TimePicker,大小怎么过,你可以做的一件事。您可以TimePicker作为一个对话框。

You cannot change the size of TimePicker, how ever you can do one thing. You can make TimePicker as a Dialog.

检查接下来的code:

Checkout the following code:

Button setTime;
setTime = (Button)findViewById(R.id.button1);
setTime.setOnClickListener(this);

public void onClick(View v) 
{
    TimePickerDialog tp1 = new TimePickerDialog(this, this, cal.get(Calendar.HOUR_OF_DAY), cal.get(Calendar.MINUTE), true);
    tp1.show();
}

public void onTimeSet(TimePicker view, int hourOfDay, int minute)
{
    cal.set(Calendar.HOUR_OF_DAY, hourOfDay);
    cal.set(Calendar.MINUTE, minute);
    //rest of the code
}

这篇关于如何使TimePicker小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆