Add Snackbar

This commit is contained in:
2018-11-21 14:57:42 +08:00
parent b34d743400
commit f9698cb7d9
4 changed files with 13 additions and 2 deletions

6
.idea/vcs.xml generated Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

View File

@ -19,10 +19,11 @@ android {
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:design:28.0.0'
}

View File

@ -2,6 +2,7 @@ package me.jj97181818.ch07_datetimepicker;
import android.app.DatePickerDialog;
import android.app.TimePickerDialog;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
@ -51,8 +52,10 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
else
txDate.setText("日期:" + year + "/" + (month + 1) + "/" + dayOfMonth);
tos.setText("owo");
tos.setText("我是一片吐司~~~");
tos.show();
Snackbar.make(findViewById(R.id.root), "日期:" + year + "/" + (month + 1) + "/" + dayOfMonth, Snackbar.LENGTH_SHORT).show();
}
@Override

View File

@ -2,6 +2,7 @@
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/root"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">