- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我从 SherlockFragmentActivity
创建了一个 SherlockDialogFragment
..
这是我到目前为止所做的::
DatePickerFragment newFragment = DatePickerFragment.newInstance(ReportDisplayActivity.this);
newFragment.show(getSupportFragmentManager(), "dialog");
SherlockDialogFragment
public class DatePickerFragment extends SherlockDialogFragment implements android.view.View.OnClickListener
{
private Button btnOk;
private TextView txtFromDate;
private TextView txtToDate;
private int setFromYear;
private int setFromMonth;
private int setFromDay;
private int setToYear;
private int setToMonth;
private int setToDay;
private final static int DIALOG_FROM_DATE_PICKER = 0;
private final static int DIALOG_TO_DATE_PICKER = 1;
private static Context context;
public DatePickerFragment() {
}
public static DatePickerFragment newInstance(Context ctx) {
DatePickerFragment frag = new DatePickerFragment();
Bundle args = new Bundle();
//args.putInt("title", title);
frag.setArguments(args);
context=ctx;
return frag;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState)
{
View rootView = inflater.inflate(R.layout.temp, container, false);
txtFromDate=(TextView)rootView.findViewById(R.id.dialog_fromDate);
txtToDate=(TextView)rootView.findViewById(R.id.dialog_toDate);
btnOk=(Button)rootView.findViewById(R.id.btn_ok);
btnOk.setOnClickListener(this);
txtFromDate.setOnClickListener(this);
txtToDate.setOnClickListener(this);
Calendar today = Calendar.getInstance();
setFromYear = today.get(Calendar.YEAR);
setFromMonth = today.get(Calendar.MONDAY);
setFromDay = today.get(Calendar.DAY_OF_MONTH);
setToYear = today.get(Calendar.YEAR);
setToMonth = today.get(Calendar.MONDAY);
setToDay = today.get(Calendar.DAY_OF_MONTH);
return rootView;
}
//@Override
protected Dialog onCreateDialog(int id)
{
switch(id)
{
case DIALOG_FROM_DATE_PICKER:
return new DatePickerDialog(context, mDateFromSetListener, setFromYear, setFromMonth, setFromDay);
case DIALOG_TO_DATE_PICKER:
return new DatePickerDialog(context, mDateToSetListener, setToYear, setToMonth, setToDay);
}
return null;
}
private DatePickerDialog.OnDateSetListener mDateFromSetListener = new DatePickerDialog.OnDateSetListener(){
@Override
public void onDateSet(android.widget.DatePicker view, int year, int month, int day) {
setFromYear = year;
setFromMonth = month;
setFromDay = day;
//returnDate();
txtFromDate.setText(setFromDay+("-")+setFromMonth+("-")+setFromYear);
}
};
private DatePickerDialog.OnDateSetListener mDateToSetListener = new DatePickerDialog.OnDateSetListener(){
@Override
public void onDateSet(android.widget.DatePicker view, int year, int month, int day) {
setToYear = year;
setToMonth = month;
setToDay = day;
txtFromDate.setText(setToDay+("-")+setToMonth+("-")+setToYear);
//returnDate();
}
};
public void onClick(View v)
{
switch (v.getId()) {
case R.id.btn_ok:
Toast.makeText(context,"Button ok",Toast.LENGTH_SHORT).show();
break;
case R.id.dialog_fromDate :
Toast.makeText(context,"From Date",Toast.LENGTH_SHORT).show();
((Activity) context).showDialog(DIALOG_FROM_DATE_PICKER);
break;
case R.id.dialog_toDate :
Toast.makeText(context,"To Date",Toast.LENGTH_SHORT).show();
((Activity) context).showDialog(DIALOG_TO_DATE_PICKER);
break;
default:
break;
}
}
}
我无法从 SherlockDialogFragment
打开 Datepicker 对话框。我无法在我的实现中找到问题所在。
如果我使用 Activity 而不是 SherlockDialogFragment
那么它工作正常。
编辑::
public class DatePickerFragment extends DialogFragment implements android.view.View.OnClickListener
{
private Button btnOk;
private TextView txtFromDate;
private TextView txtToDate;
private int setFromYear;
private int setFromMonth;
private int setFromDay;
private int setToYear;
private int setToMonth;
private int setToDay;
private final static int DIALOG_FROM_DATE_PICKER = 0;
private final static int DIALOG_TO_DATE_PICKER = 1;
private static Context context;
public DatePickerFragment() {
}
public static DatePickerFragment newInstance(Context ctx) {
DatePickerFragment frag = new DatePickerFragment();
Bundle args = new Bundle();
//args.putInt("title", title);
frag.setArguments(args);
context=ctx;
return frag;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState)
{
View rootView = inflater.inflate(R.layout.temp, container, false);
txtFromDate=(TextView)rootView.findViewById(R.id.dialog_fromDate);
txtToDate=(TextView)rootView.findViewById(R.id.dialog_toDate);
btnOk=(Button)rootView.findViewById(R.id.btn_ok);
btnOk.setOnClickListener(this);
txtFromDate.setOnClickListener(this);
txtToDate.setOnClickListener(this);
Calendar today = Calendar.getInstance();
setFromYear = today.get(Calendar.YEAR);
setFromMonth = today.get(Calendar.MONDAY);
setFromDay = today.get(Calendar.DAY_OF_MONTH);
setToYear = today.get(Calendar.YEAR);
setToMonth = today.get(Calendar.MONDAY);
setToDay = today.get(Calendar.DAY_OF_MONTH);
return rootView;
}
//@Override
protected Dialog onCreateDialog(int id)
{
switch(id)
{
case DIALOG_FROM_DATE_PICKER:
return new DatePickerDialog(context, mDateFromSetListener, setFromYear, setFromMonth, setFromDay);
case DIALOG_TO_DATE_PICKER:
return new DatePickerDialog(context, mDateToSetListener, setToYear, setToMonth, setToDay);
}
return null;
}
private DatePickerDialog.OnDateSetListener mDateFromSetListener = new DatePickerDialog.OnDateSetListener(){
@Override
public void onDateSet(android.widget.DatePicker view, int year, int month, int day) {
setFromYear = year;
setFromMonth = month;
setFromDay = day;
//returnDate();
txtFromDate.setText(setFromDay+("-")+setFromMonth+("-")+setFromYear);
}
};
private DatePickerDialog.OnDateSetListener mDateToSetListener = new DatePickerDialog.OnDateSetListener(){
@Override
public void onDateSet(android.widget.DatePicker view, int year, int month, int day) {
setToYear = year;
setToMonth = month;
setToDay = day;
txtFromDate.setText(setToDay+("-")+setToMonth+("-")+setToYear);
//returnDate();
}
};
public void onClick(View v)
{
switch (v.getId()) {
case R.id.btn_ok:
Toast.makeText(context,"Button ok",Toast.LENGTH_SHORT).show();
break;
case R.id.dialog_fromDate :
Toast.makeText(context,"From Date",Toast.LENGTH_SHORT).show();
((Activity) context).showDialog(DIALOG_FROM_DATE_PICKER);
showDatePickerDialog(txtFromDate);
break;
case R.id.dialog_toDate :
Toast.makeText(context,"To Date",Toast.LENGTH_SHORT).show();
((Activity) context).showDialog(DIALOG_TO_DATE_PICKER);
break;
default:
break;
}
}
public void showDatePickerDialog(View v)
{
DialogFragment newFragment = new DatePickerFragment();
newFragment.show(getFragmentManager(), "datePicker");
}
}
逻辑猫::
01-02 15:37:55.013: E/AndroidRuntime(933): FATAL EXCEPTION: main
01-02 15:37:55.013: E/AndroidRuntime(933): java.lang.NoClassDefFoundError: com.example.myapp.home.DatePickerFragment
01-02 15:37:55.013: E/AndroidRuntime(933): at com.example.myapp.report.ReportDisplayActivity$2.onItemSelected(ReportDisplayActivity.java:275)
01-02 15:37:55.013: E/AndroidRuntime(933): at com.actionbarsherlock.internal.widget.IcsAdapterView.fireOnSelected(IcsAdapterView.java:861)
01-02 15:37:55.013: E/AndroidRuntime(933): at com.actionbarsherlock.internal.widget.IcsAdapterView.access$2(IcsAdapterView.java:854)
01-02 15:37:55.013: E/AndroidRuntime(933): at com.actionbarsherlock.internal.widget.IcsAdapterView$SelectionNotifier.run(IcsAdapterView.java:827)
01-02 15:37:55.013: E/AndroidRuntime(933): at android.os.Handler.handleCallback(Handler.java:587)
01-02 15:37:55.013: E/AndroidRuntime(933): at android.os.Handler.dispatchMessage(Handler.java:92)
01-02 15:37:55.013: E/AndroidRuntime(933): at android.os.Looper.loop(Looper.java:130)
01-02 15:37:55.013: E/AndroidRuntime(933): at android.app.ActivityThread.main(ActivityThread.java:3683)
01-02 15:37:55.013: E/AndroidRuntime(933): at java.lang.reflect.Method.invokeNative(Native Method)
01-02 15:37:55.013: E/AndroidRuntime(933): at java.lang.reflect.Method.invoke(Method.java:507)
01-02 15:37:55.013: E/AndroidRuntime(933): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
01-02 15:37:55.013: E/AndroidRuntime(933): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
01-02 15:37:55.013: E/AndroidRuntime(933): at dalvik.system.NativeStart.main(Native Method)
编辑 2::
AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myapp"
android:versionCode="3"
android:versionName="3.0.0" >
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:name=".MyApplication"
android:icon="@drawable/icon"
android:label="@string/app_name"
android:theme="@style/Custom_ThemeSherlockLight" >
<activity
android:name=".SplashActivity"
android:clearTaskOnLaunch="true"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:theme="@style/Custom_ThemeSherlockLight" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".Login"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:theme="@style/Custom_ThemeSherlockLight"
android:windowSoftInputMode="stateHidden" >
</activity>
<activity
android:name=".MainActivity"
android:screenOrientation="portrait"
android:theme="@style/Theme.Sherlock.Light"
android:windowSoftInputMode="stateHidden" />
<!-- Reports -->
<activity
android:name=".report.ReportDisplayActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden" >
</activity>
<activity
android:name=".home.DateSelector"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden" >
</activity>
</application>
</manifest>
temp.xml(布局文件)
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/popup_top_up"
android:orientation="vertical"
android:paddingBottom="5dp" >
<TextView
android:id="@+id/lbl_fromDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginTop="45dp"
android:text="From Date :"
android:textColor="#000000"
android:textSize="20sp"
android:textStyle="bold" />
<TextView
android:id="@+id/dialog_fromDate"
style="@style/DropDownNav.Custom_ThemeSherlockLight"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/lbl_fromDate"
android:hint="@string/lbl_select_from_date"
android:layout_alignBottom="@+id/lbl_fromDate"
android:layout_marginLeft="15dp"
android:layout_toRightOf="@+id/lbl_fromDate"
android:text="@string/lbl_select_from_date"
android:textColor="#000000"
android:textSize="12sp"/>
<TextView
android:id="@+id/lbl_toDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/lbl_fromDate"
android:layout_alignParentLeft="true"
android:layout_below="@+id/lbl_fromDate"
android:layout_marginTop="22dp"
android:text="To Date :"
android:textColor="#000000"
android:textSize="20sp"
android:textStyle="bold" />
<TextView
android:id="@+id/dialog_toDate"
style="@style/DropDownNav.Custom_ThemeSherlockLight"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/lbl_toDate"
android:layout_alignBottom="@+id/lbl_toDate"
android:layout_marginLeft="5dp"
android:layout_toRightOf="@+id/lbl_toDate"
android:text="@string/lbl_select_to_date"
android:textColor="#000000"
android:textSize="12sp"/>
<Button
android:id="@+id/btn_ok"
android:layout_width="81dip"
android:layout_height="35dp"
android:layout_below="@+id/dialog_toDate"
android:layout_centerHorizontal="true"
android:layout_marginTop="45dp"
android:background="@drawable/button_selector"
android:text="OK"
android:textColor="@color/white" />
</RelativeLayout>
我可以像这样弹出对话框,但是当我点击文本“从日期选择”或“选择到日期”(从我想显示日期选择器对话框的地方)时,日期选择器对话框不显示。
样式.xml
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="Custom_ThemeSherlockLight" parent="@style/Theme.Sherlock.Light">
<item name="actionBarItemBackground">@drawable/selectable_background_exampthemesherlocklightle</item>
<item name="popupMenuStyle">@style/PopupMenu.Custom_ThemeSherlockLight</item>
<item name="dropDownListViewStyle">@style/DropDownListView.Custom_ThemeSherlockLight</item>
<item name="actionBarTabStyle">@style/ActionBarTabStyle.Custom_ThemeSherlockLight</item>
<item name="actionDropDownStyle">@style/DropDownNav.Custom_ThemeSherlockLight</item>
<item name="actionBarStyle">@style/ActionBar.Solid.Custom_ThemeSherlockLight</item>
<item name="actionModeBackground">@drawable/cab_background_top_exampthemesherlocklightle</item>
<item name="actionModeSplitBackground">@drawable/cab_background_bottom_exampthemesherlocklightle</item>
<item name="actionModeCloseButtonStyle">@style/ActionButton.CloseMode.Custom_ThemeSherlockLight</item>
</style>
<style name="ActionBar.Solid.Custom_ThemeSherlockLight" parent="@style/Widget.Sherlock.Light.ActionBar.Solid">
<item name="background">@drawable/ab_solid_exampthemesherlocklightle</item>
<item name="backgroundStacked">@drawable/ab_stacked_solid_exampthemesherlocklightle</item>
<item name="backgroundSplit">@drawable/ab_bottom_solid_exampthemesherlocklightle</item>
<item name="progressBarStyle">@style/ProgressBar.Custom_ThemeSherlockLight</item>
</style>
<style name="ActionBar.Transparent.Custom_ThemeSherlockLight" parent="@style/Widget.Sherlock.Light.ActionBar">
<item name="background">@drawable/ab_transparent_exampthemesherlocklightle</item>
<item name="progressBarStyle">@style/ProgressBar.Custom_ThemeSherlockLight</item>
</style>
<style name="PopupMenu.Custom_ThemeSherlockLight" parent="@style/Widget.Sherlock.Light.ListPopupWindow">
<item name="android:popupBackground">@drawable/menu_dropdown_panel_exampthemesherlocklightle</item>
</style>
<style name="DropDownListView.Custom_ThemeSherlockLight" parent="@style/Widget.Sherlock.Light.ListView.DropDown">
<item name="android:listSelector">@drawable/selectable_background_exampthemesherlocklightle</item>
</style>
<style name="ActionBarTabStyle.Custom_ThemeSherlockLight" parent="@style/Widget.Sherlock.Light.ActionBar.TabView">
<item name="android:background">@drawable/tab_indicator_ab_exampthemesherlocklightle</item>
</style>
<style name="DropDownNav.Custom_ThemeSherlockLight" parent="@style/Widget.Sherlock.Light.Spinner.DropDown.ActionBar">
<item name="android:dropDownSelector">@drawable/selectable_background_exampthemesherlocklightle</item>
</style>
<style name="ProgressBar.Custom_ThemeSherlockLight" parent="@style/Widget.Sherlock.Light.ProgressBar.Horizontal">
<item name="android:progressDrawable">@drawable/progress_horizontal_exampthemesherlocklightle</item>
</style>
<style name="ActionButton.CloseMode.Custom_ThemeSherlockLight" parent="@style/Widget.Sherlock.Light.ActionButton.CloseMode">
<item name="android:background">@drawable/btn_cab_done_exampthemesherlocklightle</item>
</style>
<!-- this style is only referenced in a Light.DarkActionBar based theme -->
<style name="Theme.Custom_ThemeSherlockLight.Widget" parent="@style/Theme.Sherlock">
<item name="popupMenuStyle">@style/PopupMenu.Custom_ThemeSherlockLight</item>
<item name="dropDownListViewStyle">@style/DropDownListView.Custom_ThemeSherlockLight</item>
</style>
<style name="Theme.Sherlock.Translucent" parent="@style/Theme.Sherlock">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsFloating">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:backgroundDimEnabled">false</item>
<item name="android:backgroundDimEnabled">true</item>
</style>
</resources>
最佳答案
这是解决方案,
主要 Activity
public class MainActivity extends SherlockFragmentActivity
{
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
DatePickerFragment newFragment = DatePickerFragment.newInstance(this);
newFragment.show(ft, "dialog");
}
}
主.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="@string/hello_world" />
</RelativeLayout>
日期选择器 fragment
public class DatePickerFragment extends SherlockDialogFragment implements android.view.View.OnClickListener
{
private final static int DIALOG_FROM_DATE_PICKER = 0;
private final static int DIALOG_TO_DATE_PICKER = 1;
private static Context context;
private Button btnOk;
private TextView txtFromDate;
private TextView txtToDate;
private int setFromYear;
private int setFromMonth;
private int setFromDay;
private int setToYear;
private int setToMonth;
private int setToDay;
private int dialog=0;
public static DatePickerFragment newInstance( Context ctx )
{
DatePickerFragment frag = new DatePickerFragment();
Bundle args = new Bundle();
frag.setArguments(args);
context=ctx;
return frag;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState)
{
View rootView = inflater.inflate(R.layout.fragment_dialog, container, false);
txtFromDate=(TextView)rootView.findViewById(R.id.dialog_fromDate);
txtToDate=(TextView)rootView.findViewById(R.id.dialog_toDate);
btnOk=(Button)rootView.findViewById(R.id.btn_ok);
btnOk.setOnClickListener(this);
txtFromDate.setOnClickListener(this);
txtToDate.setOnClickListener(this);
Calendar today = Calendar.getInstance();
setFromYear = today.get(Calendar.YEAR);
setFromMonth = today.get(Calendar.MONTH);
setFromDay = today.get(Calendar.DAY_OF_MONTH);
setToYear = today.get(Calendar.YEAR);
setToMonth = today.get(Calendar.MONTH);
setToDay = today.get(Calendar.DAY_OF_MONTH);
return rootView;
}
private void showDatePickerDialog ( int id )
{
switch ( id )
{
case DIALOG_FROM_DATE_PICKER:
new DatePickerDialog(context, mDateSetListener, setFromYear, setFromMonth, setFromDay).show();
break;
case DIALOG_TO_DATE_PICKER:
new DatePickerDialog(context, mDateSetListener, setToYear, setToMonth, setToDay).show();
}
}
@Override
public void onClick( View v )
{
switch (v.getId())
{
case R.id.btn_ok:
Toast.makeText(context,"Button ok",Toast.LENGTH_SHORT).show();
break;
case R.id.dialog_fromDate :
dialog = DIALOG_FROM_DATE_PICKER;
showDatePickerDialog (DIALOG_FROM_DATE_PICKER);
break;
case R.id.dialog_toDate :
dialog = DIALOG_TO_DATE_PICKER;
showDatePickerDialog(DIALOG_TO_DATE_PICKER);
break;
default:
break;
}
}
private DatePickerDialog.OnDateSetListener mDateSetListener = new DatePickerDialog.OnDateSetListener()
{
@Override
public void onDateSet(android.widget.DatePicker view, int year, int month, int day)
{
if ( dialog == DIALOG_FROM_DATE_PICKER )
{
setFromYear = year;
setFromMonth = month+1;
setFromDay = day;
txtFromDate.setText(setFromDay+("-")+setFromMonth+("-")+setFromYear);
}
else if ( dialog == DIALOG_TO_DATE_PICKER )
{
setToYear = year;
setToMonth = month+1;
setToDay = day;
txtToDate.setText(setToDay+("-")+setToMonth+("-")+setToYear);
}
}
};
}
fragment _对话框.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="5dp" >
<TextView
android:id="@+id/lbl_fromDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginTop="45dp"
android:text="From Date :"
android:textColor="#000000"
android:textSize="20sp"
android:textStyle="bold" />
<TextView
android:id="@+id/dialog_fromDate"
style="@style/DropDownNav.Custom_ThemeSherlockLight"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/lbl_fromDate"
android:hint="@string/lbl_select_from_date"
android:layout_alignBottom="@+id/lbl_fromDate"
android:layout_marginLeft="15dp"
android:layout_toRightOf="@+id/lbl_fromDate"
android:text="@string/lbl_select_from_date"
android:textColor="#000000"
android:textSize="12sp"/>
<TextView
android:id="@+id/lbl_toDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/lbl_fromDate"
android:layout_alignParentLeft="true"
android:layout_below="@+id/lbl_fromDate"
android:layout_marginTop="22dp"
android:text="To Date :"
android:textColor="#000000"
android:textSize="20sp"
android:textStyle="bold" />
<TextView
android:id="@+id/dialog_toDate"
style="@style/DropDownNav.Custom_ThemeSherlockLight"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/lbl_toDate"
android:layout_alignBottom="@+id/lbl_toDate"
android:layout_marginLeft="5dp"
android:layout_toRightOf="@+id/lbl_toDate"
android:text="@string/lbl_select_to_date"
android:textColor="#000000"
android:textSize="12sp"/>
<Button
android:id="@+id/btn_ok"
android:layout_width="81dip"
android:layout_height="35dp"
android:layout_below="@+id/dialog_toDate"
android:layout_centerHorizontal="true"
android:layout_marginTop="45dp"
android:text="OK"
android:textColor="@color/white" />
</RelativeLayout>
style.xml 与您的代码相同。
我在您的代码中发现您是通过以下语句获取月份 setFromMonth = today.get(Calendar.MONDAY);
或 setToMonth = today.get(Calendar.MONDAY);
。我相信你做错了。我还通过编写一个通用的 mDateSetListener
监听器来最小化您的代码。另请记住,Calendar.MONTH 对 1 月返回 0,因为它的索引以 0 开头。在将月份值设置为相应的 TextView 之前,我在监听器中添加了 +1。
关于android - 从对话框调用 onCreateDialog(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20879488/
为了让我的代码几乎完全用 Jquery 编写,我想用 Jquery 重写 AJAX 调用。 这是从网页到 Tomcat servlet 的调用。 我目前情况的类似代码: var http = new
我想使用 JNI 从 Java 调用 C 函数。在 C 函数中,我想创建一个 JVM 并调用一些 Java 对象。当我尝试创建 JVM 时,JNI_CreateJavaVM 返回 -1。 所以,我想知
环顾四周,我发现从 HTML 调用 Javascript 函数的最佳方法是将函数本身放在 HTML 中,而不是外部 Javascript 文件。所以我一直在网上四处寻找,找到了一些简短的教程,我可以根
我有这个组件: import {Component} from 'angular2/core'; import {UserServices} from '../services/UserService
我正在尝试用 C 实现一个简单的 OpenSSL 客户端/服务器模型,并且对 BIO_* 调用的使用感到好奇,与原始 SSL_* 调用相比,它允许一些不错的功能。 我对此比较陌生,所以我可能会完全错误
我正在处理有关异步调用的难题: 一个 JQuery 函数在用户点击时执行,然后调用一个 php 文件来检查用户输入是否与数据库中已有的信息重叠。如果是这样,则应提示用户确认是否要继续或取消,如果他单击
我有以下类(class)。 public Task { public static Task getInstance(String taskName) { return new
嘿,我正在构建一个小游戏,我正在通过制作一个数字 vector 来创建关卡,该数字 vector 通过枚举与 1-4 种颜色相关联。问题是循环(在 Simon::loadChallenge 中)我将颜
我有一个java spring boot api(数据接收器),客户端调用它来保存一些数据。一旦我完成了数据的持久化,我想进行另一个 api 调用(应该处理持久化的数据 - 数据聚合器),它应该自行异
首先,这涉及桌面应用程序而不是 ASP .Net 应用程序。 我已经为我的项目添加了一个 Web 引用,并构建了各种数据对象,例如 PayerInfo、Address 和 CreditCard。但问题
我如何告诉 FAKE 编译 .fs文件使用 fsc ? 解释如何传递参数的奖励积分,如 -a和 -target:dll . 编辑:我应该澄清一下,我正在尝试在没有 MSBuild/xbuild/.sl
我使用下划线模板配置了一个简单的主干模型和 View 。两个单独的 API 使用完全相同的配置。 API 1 按预期工作。 要重现该问题,请注释掉 API 1 的 URL,并取消注释 API 2 的
我不确定什么是更好的做法或更现实的做法。我希望从头开始创建目录系统,但不确定最佳方法是什么。 我想我在需要显示信息时使用对象,例如 info.php?id=100。有这样的代码用于显示 Game.cl
from datetime import timedelta class A: def __abs__(self): return -self class B1(A):
我在操作此生命游戏示例代码中的数组时遇到问题。 情况: “生命游戏”是约翰·康威发明的一种细胞自动化技术。它由一个细胞网格组成,这些细胞可以根据数学规则生存/死亡/繁殖。该网格中的活细胞和死细胞通过
如果我像这样调用 read() 来读取文件: unsigned char buf[512]; memset(buf, 0, sizeof(unsigned char) * 512); int fd;
我用 C 编写了一个简单的服务器,并希望调用它的功能与调用其他 C 守护程序的功能相同(例如使用 ./ftpd start 调用它并使用 ./ftpd stop 关闭该实例)。显然我遇到的问题是我不知
在 dos 中,当我粘贴此命令时它会起作用: "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" https://google.
在 dos 中,当我粘贴此命令时它会起作用: "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" https://google.
我希望能够从 cmd 在我的 Windows 10 计算机上调用 python3。 我已重新安装 Python3.7 以确保选择“添加到路径”选项,但仍无法调用 python3 并使 CMD 启动 P
我是一名优秀的程序员,十分优秀!