فهرست منبع

функции кнопок

user2 4 سال پیش
والد
کامیت
e00a6eec53

+ 1 - 1
app/build.gradle

@@ -25,7 +25,7 @@ android {
 
 dependencies {
     implementation fileTree(dir: 'libs', include: ['*.jar'])
-    implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
+    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
     implementation 'androidx.appcompat:appcompat:1.0.2'
     implementation 'androidx.core:core-ktx:1.0.2'
     implementation 'androidx.constraintlayout:constraintlayout:1.1.3'

+ 2 - 0
app/src/main/AndroidManifest.xml

@@ -9,6 +9,8 @@
         android:roundIcon="@mipmap/ic_launcher_round"
         android:supportsRtl="true"
         android:theme="@style/Theme.AppCompat.NoActionBar">
+        <activity android:name=".kyrs"></activity>
+        <activity android:name=".proekt2" />
         <activity android:name=".MainActivity">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />

+ 11 - 0
app/src/main/java/su/ktk/proekt2608/MainActivity.kt

@@ -1,7 +1,9 @@
 package su.ktk.proekt2608
 
+import android.content.Intent
 import androidx.appcompat.app.AppCompatActivity
 import android.os.Bundle
+import android.view.View
 
 class MainActivity : AppCompatActivity() {
 
@@ -9,5 +11,14 @@ class MainActivity : AppCompatActivity() {
         super.onCreate(savedInstanceState)
         setContentView(R.layout.activity_main)
     }
+
+    fun buttonkyrsClick(view: View) {
+        val intent= Intent(this,proekt2::class.java)
+        startActivity(intent)
+    }
+    fun buttonBanksClick(view: View) {
+        val intent=Intent (this,kyrs::class.java)
+        startActivity(intent)
+    }
 }
 //jhnjkkjkugfuh

+ 12 - 0
app/src/main/java/su/ktk/proekt2608/kyrs.kt

@@ -0,0 +1,12 @@
+package su.ktk.proekt2608
+
+import androidx.appcompat.app.AppCompatActivity
+import android.os.Bundle
+
+class kyrs : AppCompatActivity() {
+
+    override fun onCreate(savedInstanceState: Bundle?) {
+        super.onCreate(savedInstanceState)
+        setContentView(R.layout.activity_kyrs)
+    }
+}

+ 12 - 0
app/src/main/java/su/ktk/proekt2608/proekt2.kt

@@ -0,0 +1,12 @@
+package su.ktk.proekt2608
+
+import androidx.appcompat.app.AppCompatActivity
+import android.os.Bundle
+
+class proekt2 : AppCompatActivity() {
+
+    override fun onCreate(savedInstanceState: Bundle?) {
+        super.onCreate(savedInstanceState)
+        setContentView(R.layout.activity_proekt2)
+    }
+}

+ 9 - 0
app/src/main/res/layout/activity_kyrs.xml

@@ -0,0 +1,9 @@
+<?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=".kyrs">
+
+</androidx.constraintlayout.widget.ConstraintLayout>

+ 14 - 14
app/src/main/res/layout/activity_main.xml

@@ -44,33 +44,33 @@
     android:layout_marginLeft="8.5dp"
     android:layout_marginRight="8.5dp">
 
-        <Button
-            android:id="@+id/button1"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_gravity="center_horizontal"
-            android:background="@drawable/button1"
-            android:layout_marginTop="50dp"
-            android:text="Button" />
 
-    <ImageView
-        android:id="@+id/imageView"
+
+    <Button
+        android:id="@+id/imageButton"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        app:srcCompat="@drawable/key" />
+        android:background="@drawable/button1"
+        android:drawableStart="@drawable/key"
+        android:drawableLeft="@drawable/key"
+        android:drawablePadding="50dp"
+        android:onClick="buttonBanksClick"
+         />
 
     <Button
             android:id="@+id/button2"
-            android:layout_width="wrap_content"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="Button"
             android:background="@drawable/button2"
             android:layout_gravity="center_horizontal"
-        android:layout_marginTop="50dp"/>
+        android:layout_marginTop="50dp"
+        android:onClick="buttonkyrsClick"
+        />
 
         <Button
             android:id="@+id/button3"
-            android:layout_width="wrap_content"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="Button"
             android:background="@drawable/button3"

+ 9 - 0
app/src/main/res/layout/activity_proekt2.xml

@@ -0,0 +1,9 @@
+<?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=".proekt2">
+
+</androidx.constraintlayout.widget.ConstraintLayout>