一直試圖看看這裏的其他問題關於DatePickers彈出EditText
,但我有問題得到它的工作。彈出DatePicker的EditText
我看過例子,你可以使用setOnClickListener
或setOnTouchListener
,哪一個最好?
另外我見過DatePicker
有幾種不同的設計,你如何改變設計?
下面是我的代碼到目前爲止,嘗試使用其他示例中的代碼,但無法使其工作。
import android.app.Activity;
import android.os.Bundle;
import android.widget.EditText;
import android.widget.TextView;
/**
* Created by MOS182 on 7/21/13.
*/
public class AddReminder extends Activity {
TextView Title, Amount, PaymentDate, ReminderDate, ReminderTime;
EditText eTitle, eAmount, ePaymentDate, eReminderDate, eReminderTime;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.reminders_dialog);
initializeVariables();
}
private void initializeVariables()
{
Title = (TextView) findViewById(R.id.tvTitle);
Amount = (TextView) findViewById(R.id.tvAmount);
PaymentDate = (TextView) findViewById(R.id.tvPaymentDate);
ReminderDate = (TextView) findViewById(R.id.tvReminderDate);
ReminderTime = (TextView) findViewById(R.id.tvReminderTime);
eTitle = (EditText) findViewById(R.id.etTitle);
eAmount = (EditText) findViewById(R.id.etAmount);
ePaymentDate = (EditText) findViewById(R.id.etPaymentDate);
eReminderDate = (EditText) findViewById(R.id.etReminderDate);
eReminderTime = (EditText) findViewById(R.id.etReminderTime);
}
}
http://developer.android.com/guide/topics/ui/controls/ pickers.html。檢查它有代碼片段的文檔。另外**你如何改變設計**請詳細說明。 – Raghunandan
你有沒有試過DatePickerDialog? – R9J
@ R9j我在看其他例子時試過,無法正常工作,就像我不知道如何正確設置它 –