Skip to content

Commit 26f3e3a

Browse files
committed
project #8: add 4 column in the second linear layout
1 parent 1bfab0c commit 26f3e3a

File tree

6 files changed

+213
-1
lines changed

6 files changed

+213
-1
lines changed

Calculator/.idea/codeStyles/Project.xml

Lines changed: 139 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Calculator/.idea/codeStyles/codeStyleConfig.xml

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Calculator/.idea/gradle.xml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Calculator/app/src/main/java/com/example/calculator/MainActivity.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@ package com.example.calculator
22

33
import androidx.appcompat.app.AppCompatActivity
44
import android.os.Bundle
5+
import android.view.View
56

67
class MainActivity : AppCompatActivity() {
78
override fun onCreate(savedInstanceState: Bundle?) {
89
super.onCreate(savedInstanceState)
910
setContentView(R.layout.activity_main)
1011
}
12+
13+
fun onDigit(view: View) {}
1114
}

Calculator/app/src/main/res/layout/activity_main.xml

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,68 @@
44
xmlns:tools="http://schemas.android.com/tools"
55
android:layout_width="match_parent"
66
android:layout_height="match_parent"
7+
android:orientation="vertical"
78
tools:context=".MainActivity">
89

9-
10+
<TextView
11+
android:id="@+id/tvInput"
12+
android:layout_width="match_parent"
13+
android:layout_height="250dp"
14+
android:background="#fefefe"
15+
android:ems="10"
16+
android:maxLength="12"
17+
android:padding="10dp"
18+
android:textSize="48sp" />
19+
20+
<!-- buttons layout in new liner layout-->
21+
<LinearLayout
22+
android:layout_width="match_parent"
23+
android:layout_height="0dp"
24+
android:layout_marginTop="2dp"
25+
android:layout_weight="1"
26+
android:orientation="horizontal">
27+
28+
<Button
29+
android:id="@+id/btnSeven"
30+
android:layout_width="0dp"
31+
android:layout_height="match_parent"
32+
android:layout_weight="1"
33+
android:onClick="onDigit"
34+
android:text="@string/_7"
35+
android:textSize="20sp"
36+
tools:ignore="ButtonStyle,NestedWeights" />
37+
<Button
38+
android:id="@+id/btnEight"
39+
android:layout_width="0dp"
40+
android:layout_height="match_parent"
41+
android:layout_weight="1"
42+
android:onClick="onDigit"
43+
android:text="@string/_8"
44+
android:textSize="20sp"
45+
tools:ignore="ButtonStyle,NestedWeights" />
46+
47+
<Button
48+
android:id="@+id/btnNine"
49+
android:layout_width="0dp"
50+
android:layout_height="match_parent"
51+
android:layout_weight="1"
52+
android:onClick="onDigit"
53+
android:text="@string/_9"
54+
android:textSize="20sp"
55+
tools:ignore="ButtonStyle,NestedWeights" />
56+
57+
<Button
58+
android:id="@+id/btnDivide"
59+
android:layout_width="0dp"
60+
android:layout_height="match_parent"
61+
android:layout_weight="1"
62+
android:onClick="onDigit"
63+
android:text="@string/divide"
64+
android:textSize="20sp"
65+
tools:ignore="ButtonStyle,NestedWeights" />
66+
67+
68+
</LinearLayout>
69+
1070

1171
</LinearLayout>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
<resources>
22
<string name="app_name">Calculator</string>
3+
<string name="_7">7</string>
4+
<string name="_8">8</string>
5+
<string name="_9">9</string>
6+
<string name="divide">/</string>
37
</resources>

0 commit comments

Comments
 (0)