- Главная
- Информатика
- Android
Содержание
Слайд 3Activity_main.xml
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_baseline_create_new_folder_24"
android:layout_gravity="end|bottom"
android:layout_margin="16dp"
tools:ignore="MissingConstraints" />
Activity_main.xml
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_baseline_create_new_folder_24"
android:layout_gravity="end|bottom"
android:layout_margin="16dp"
tools:ignore="MissingConstraints" />
Слайд 4MainActivity.kt
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
MainActivity.kt
class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main)
button_simple.setOnClickListener {
Snackbar.make(
it,
"Hello Snackbar!",
Snackbar.LENGTH_SHORT
).show()
}
button_action.setOnClickListener {
root_layout.setBackgroundColor(Color.YELLOW)
Snackbar.make(
root_layout,
"We changes app background color.",
Snackbar.LENGTH_LONG //
).setAction(
"Undo"
)
{
root_layout.setBackgroundColor(Color.parseColor("#f2f2f2"))
}.show()
}