Advertisement
Guest User

Untitled

a guest
Dec 7th, 2019
432
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Kotlin 4.19 KB | None | 0 0
  1. MainActivity.kt
  2. override fun onCreate(savedInstanceState: Bundle?) {
  3.         super.onCreate(savedInstanceState)
  4.         setContentView(R.layout.activity_main)
  5.         setSupportActionBar(toolbar)
  6.  
  7.         start.setOnClickListener {
  8.             val intent = Intent(this, Card::class.java);
  9.             startActivity(intent);
  10.         }
  11.     }
  12.  
  13. Card.kt
  14. override fun onCreate(savedInstanceState: Bundle?) {
  15.         super.onCreate(savedInstanceState)
  16.         setContentView(R.layout.activity_card)
  17.         next.setOnClickListener{
  18.             if (checkbox1.isChecked){
  19.                 text.text = "dog"
  20.             }
  21.         }
  22.     }
  23.  
  24. activity_main.xml
  25. <?xml version="1.0" encoding="utf-8"?>
  26. <android.widget.LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  27.     xmlns:tools="http://schemas.android.com/tools"
  28.     android:layout_width="match_parent"
  29.     android:layout_height="match_parent"
  30.     xmlns:app="http://schemas.android.com/apk/res-auto"
  31.     android:orientation="vertical"
  32.     android:weightSum="10"
  33.     tools:context=".MainActivity">
  34.  
  35.     <com.google.android.material.appbar.AppBarLayout
  36.         android:id="@+id/appbar"
  37.         android:layout_width="match_parent"
  38.         android:theme="@style/AppTheme.AppBarOverlay"
  39.         android:layout_weight="1"
  40.         android:layout_height="0dp">
  41.  
  42.         <androidx.appcompat.widget.Toolbar
  43.             android:id="@+id/toolbar"
  44.             android:layout_width="match_parent"
  45.             android:layout_height="?attr/actionBarSize"
  46.             android:background="?attr/colorPrimary"
  47.             app:popupTheme="@style/AppTheme.PopupOverlay" />
  48.  
  49.     </com.google.android.material.appbar.AppBarLayout>
  50.  
  51.     <ScrollView
  52.         android:layout_width="match_parent"
  53.         android:layout_weight="8"
  54.         android:layout_height="0dp">
  55.  
  56.         <LinearLayout
  57.             android:layout_width="match_parent"
  58.             android:layout_height="match_parent"
  59.             android:orientation="vertical">
  60.  
  61.             <CheckBox
  62.                 android:id="@+id/checkbox1"
  63.                 android:text="@string/checkbox1"
  64.                 android:layout_width="match_parent"
  65.                 android:layout_height="35dp"/>
  66.            
  67. //dalsi checkboxy
  68.  
  69.         </LinearLayout>
  70.     </ScrollView>
  71.  
  72.     <Button
  73.         android:id="@+id/start"
  74.         android:text="@string/start"
  75.         android:layout_width="match_parent"
  76.         android:layout_height="0dp"
  77.         android:theme="@style/AppTheme.AppBarOverlay"
  78.         android:layout_weight="1"/>
  79.  
  80. </android.widget.LinearLayout>
  81.  
  82. activity_card.xml
  83. <?xml version="1.0" encoding="utf-8"?>
  84. <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
  85.     xmlns:app="http://schemas.android.com/apk/res-auto"
  86.     xmlns:tools="http://schemas.android.com/tools"
  87.     android:layout_width="match_parent"
  88.     android:layout_height="match_parent"
  89.     tools:context=".Card">
  90.  
  91.     <TextView
  92.         android:id="@+id/text"
  93.         android:layout_width="match_parent"
  94.         android:layout_height="match_parent"
  95.         android:gravity="center"
  96.         android:text="cat"/>
  97.  
  98.     <LinearLayout
  99.         android:layout_width="match_parent"
  100.         android:layout_height="160dp"
  101.         app:layout_constraintBottom_toBottomOf="parent"
  102.         android:orientation="horizontal"
  103.         android:weightSum="3">
  104.  
  105.         <Button
  106.             android:id="@+id/known"
  107.             android:layout_width="150dp"
  108.             android:layout_height="match_parent"
  109.             android:layout_weight="1"
  110.             android:background="@drawable/ic_check_black_24dp"/>
  111.  
  112.         <Button
  113.             android:id="@+id/show"
  114.             android:layout_width="150dp"
  115.             android:layout_height="match_parent"
  116.             android:layout_weight="1"
  117.             android:background="@drawable/ic_cached_black_24dp"/>
  118.  
  119.         <Button
  120.             android:id="@+id/next"
  121.             android:layout_width="150dp"
  122.             android:layout_height="match_parent"
  123.             android:layout_weight="1"
  124.             android:background="@drawable/ic_arrow_forward_black_24dp"/>
  125.  
  126.     </LinearLayout>
  127.  
  128. </androidx.constraintlayout.widget.ConstraintLayout>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement