Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- MainActivity.kt
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
- setSupportActionBar(toolbar)
- start.setOnClickListener {
- val intent = Intent(this, Card::class.java);
- startActivity(intent);
- }
- }
- Card.kt
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_card)
- next.setOnClickListener{
- if (checkbox1.isChecked){
- text.text = "dog"
- }
- }
- }
- activity_main.xml
- <?xml version="1.0" encoding="utf-8"?>
- <android.widget.LinearLayout 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"
- xmlns:app="http://schemas.android.com/apk/res-auto"
- android:orientation="vertical"
- android:weightSum="10"
- tools:context=".MainActivity">
- <com.google.android.material.appbar.AppBarLayout
- android:id="@+id/appbar"
- android:layout_width="match_parent"
- android:theme="@style/AppTheme.AppBarOverlay"
- android:layout_weight="1"
- android:layout_height="0dp">
- <androidx.appcompat.widget.Toolbar
- android:id="@+id/toolbar"
- android:layout_width="match_parent"
- android:layout_height="?attr/actionBarSize"
- android:background="?attr/colorPrimary"
- app:popupTheme="@style/AppTheme.PopupOverlay" />
- </com.google.android.material.appbar.AppBarLayout>
- <ScrollView
- android:layout_width="match_parent"
- android:layout_weight="8"
- android:layout_height="0dp">
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical">
- <CheckBox
- android:id="@+id/checkbox1"
- android:text="@string/checkbox1"
- android:layout_width="match_parent"
- android:layout_height="35dp"/>
- //dalsi checkboxy
- </LinearLayout>
- </ScrollView>
- <Button
- android:id="@+id/start"
- android:text="@string/start"
- android:layout_width="match_parent"
- android:layout_height="0dp"
- android:theme="@style/AppTheme.AppBarOverlay"
- android:layout_weight="1"/>
- </android.widget.LinearLayout>
- activity_card.xml
- <?xml version="1.0" encoding="utf-8"?>
- <androidx.constraintlayout.widget.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:layout_width="match_parent"
- android:layout_height="match_parent"
- tools:context=".Card">
- <TextView
- android:id="@+id/text"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:gravity="center"
- android:text="cat"/>
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="160dp"
- app:layout_constraintBottom_toBottomOf="parent"
- android:orientation="horizontal"
- android:weightSum="3">
- <Button
- android:id="@+id/known"
- android:layout_width="150dp"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:background="@drawable/ic_check_black_24dp"/>
- <Button
- android:id="@+id/show"
- android:layout_width="150dp"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:background="@drawable/ic_cached_black_24dp"/>
- <Button
- android:id="@+id/next"
- android:layout_width="150dp"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:background="@drawable/ic_arrow_forward_black_24dp"/>
- </LinearLayout>
- </androidx.constraintlayout.widget.ConstraintLayout>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement