-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update
- Loading branch information
Showing
7 changed files
with
102 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,6 @@ | |
.DS_Store | ||
/build | ||
/captures | ||
/.idea | ||
|
||
/**/.idea/ |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
...rc/main/java/com/example/jiayu/helloworld/Chapter2/Chapter2DatePickerTimPickerDialog.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package com.example.jiayu.helloworld.Chapter2; | ||
|
||
import android.app.DatePickerDialog; | ||
import android.support.v7.app.AppCompatActivity; | ||
import android.os.Bundle; | ||
import android.view.View; | ||
import android.widget.Button; | ||
import android.widget.DatePicker; | ||
import android.widget.EditText; | ||
|
||
import com.example.jiayu.helloworld.R; | ||
|
||
import java.util.Calendar; | ||
|
||
public class Chapter2DatePickerTimPickerDialog extends AppCompatActivity { | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_chapter2_date_picker_tim_picker_dialog); | ||
|
||
Button datebn = (Button) findViewById(R.id.dateBn); | ||
Button timebn = (Button) findViewById(R.id.timeBn); | ||
|
||
|
||
datebn.setOnClickListener(new View.OnClickListener() { | ||
@Override | ||
public void onClick(View v) { | ||
Calendar c = Calendar.getInstance(); | ||
int year = c.get(Calendar.YEAR); | ||
int month = c.get(Calendar.MONTH); | ||
int day = c.get(Calendar.DAY_OF_MONTH); | ||
|
||
|
||
|
||
new DatePickerDialog(Chapter2DatePickerTimPickerDialog.this, | ||
new DatePickerDialog.OnDateSetListener() { | ||
@Override | ||
public void onDateSet (DatePicker view,int year, int monthOfYear, int dayOfMonth){ | ||
EditText show = (EditText) findViewById(R.id.show); | ||
show.setText("你选择了: " + year + "年 " + monthOfYear + "月 " + dayOfMonth + "日"); | ||
} | ||
|
||
year, | ||
month, | ||
day | ||
}); | ||
} | ||
|
||
|
||
|
||
|
||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
app/src/main/res/layout/activity_chapter2_date_picker_tim_picker_dialog.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:orientation="vertical" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent"> | ||
|
||
<TextView | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:text="DateDialog Test"/> | ||
|
||
<LinearLayout | ||
android:orientation="horizontal" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content"> | ||
<TextView | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:text="你选择的时间是:" | ||
/> | ||
<EditText | ||
android:id="@+id/show" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" /> | ||
</LinearLayout> | ||
|
||
<Button | ||
android:id="@+id/dateBn" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:text="DatePicker"/> | ||
|
||
<Button | ||
android:id="@+id/timeBn" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:text="TimePicker"/> | ||
|
||
</LinearLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#Mon Apr 18 23:19:46 CST 2016 | ||
#Wed Sep 21 00:34:13 CST 2016 | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip |