273 lines
10 KiB
XML
273 lines
10 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
||
<LinearLayout 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:id="@+id/main"
|
||
android:layout_width="match_parent"
|
||
android:orientation="vertical"
|
||
android:layout_height="match_parent"
|
||
tools:context=".activities.MainActivity">
|
||
|
||
<!-- Calculator Display -->
|
||
<TextView
|
||
android:id="@+id/display"
|
||
android:layout_width="match_parent"
|
||
android:layout_height="wrap_content"
|
||
android:layout_margin="16dp"
|
||
android:layout_weight="2"
|
||
android:layout_marginTop="0dp"
|
||
android:background="#00000000"
|
||
android:elevation="4dp"
|
||
android:gravity="end|bottom"
|
||
android:padding="10dp"
|
||
android:text="0"
|
||
android:textSize="48sp"
|
||
tools:ignore="Suspicious0dp" />
|
||
|
||
|
||
<!-- Calculator Buttons -->
|
||
<GridLayout
|
||
android:layout_width="match_parent"
|
||
android:layout_height="0dp"
|
||
android:layout_margin="8dp"
|
||
android:columnCount="4"
|
||
android:layout_weight="5"
|
||
android:rowCount="5">
|
||
|
||
<!-- Row 1 -->
|
||
<com.google.android.material.button.MaterialButton
|
||
android:id="@+id/btnClear"
|
||
android:layout_width="0dp"
|
||
android:layout_height="0dp"
|
||
android:layout_rowWeight="1"
|
||
android:layout_columnWeight="1"
|
||
android:layout_margin="4dp"
|
||
android:textSize="30sp"
|
||
android:text="C"
|
||
app:cornerRadius="15dp"
|
||
style="@style/Widget.MaterialComponents.Button.OutlinedButton"/>
|
||
|
||
<com.google.android.material.button.MaterialButton
|
||
android:id="@+id/btnParentheses"
|
||
android:layout_width="0dp"
|
||
android:layout_height="0dp"
|
||
android:layout_rowWeight="1"
|
||
android:layout_columnWeight="1"
|
||
android:textSize="30sp"
|
||
android:layout_margin="4dp"
|
||
android:text="( )"
|
||
app:cornerRadius="15dp"
|
||
style="@style/Widget.MaterialComponents.Button.OutlinedButton"/>
|
||
|
||
<com.google.android.material.button.MaterialButton
|
||
android:id="@+id/btnPercent"
|
||
android:layout_width="0dp"
|
||
android:layout_height="0dp"
|
||
android:layout_rowWeight="1"
|
||
android:layout_columnWeight="1"
|
||
android:textSize="30sp"
|
||
android:layout_margin="4dp"
|
||
android:text="%"
|
||
app:cornerRadius="15dp"
|
||
style="@style/Widget.MaterialComponents.Button.OutlinedButton"/>
|
||
|
||
<com.google.android.material.button.MaterialButton
|
||
android:id="@+id/btnDivide"
|
||
android:layout_width="0dp"
|
||
android:layout_height="0dp"
|
||
android:layout_rowWeight="1"
|
||
android:layout_columnWeight="1"
|
||
android:textSize="30sp"
|
||
android:layout_margin="4dp"
|
||
android:text="÷"
|
||
app:cornerRadius="15dp"
|
||
style="@style/Widget.MaterialComponents.Button"/>
|
||
|
||
<!-- Row 2 -->
|
||
<com.google.android.material.button.MaterialButton
|
||
android:id="@+id/btn7"
|
||
android:layout_width="0dp"
|
||
android:layout_height="0dp"
|
||
android:layout_rowWeight="1"
|
||
android:layout_columnWeight="1"
|
||
android:textSize="30sp"
|
||
android:layout_margin="4dp"
|
||
android:text="7"
|
||
app:cornerRadius="15dp"
|
||
style="@style/Widget.MaterialComponents.Button.OutlinedButton"/>
|
||
|
||
<com.google.android.material.button.MaterialButton
|
||
android:id="@+id/btn8"
|
||
android:layout_width="0dp"
|
||
android:layout_height="0dp"
|
||
android:layout_rowWeight="1"
|
||
android:layout_columnWeight="1"
|
||
android:textSize="30sp"
|
||
android:layout_margin="4dp"
|
||
android:text="8"
|
||
app:cornerRadius="15dp"
|
||
style="@style/Widget.MaterialComponents.Button.OutlinedButton"/>
|
||
|
||
<com.google.android.material.button.MaterialButton
|
||
android:id="@+id/btn9"
|
||
android:layout_width="0dp"
|
||
android:layout_height="0dp"
|
||
android:layout_rowWeight="1"
|
||
android:layout_columnWeight="1"
|
||
android:layout_margin="4dp"
|
||
android:textSize="30sp"
|
||
android:text="9"
|
||
app:cornerRadius="15dp"
|
||
style="@style/Widget.MaterialComponents.Button.OutlinedButton"/>
|
||
|
||
<com.google.android.material.button.MaterialButton
|
||
android:id="@+id/btnMultiply"
|
||
android:layout_width="0dp"
|
||
android:layout_height="0dp"
|
||
android:layout_rowWeight="1"
|
||
android:layout_columnWeight="1"
|
||
android:layout_margin="4dp"
|
||
android:textSize="30sp"
|
||
android:text="×"
|
||
app:cornerRadius="15dp"
|
||
style="@style/Widget.MaterialComponents.Button"/>
|
||
|
||
<!-- Row 3 -->
|
||
<com.google.android.material.button.MaterialButton
|
||
android:id="@+id/btn4"
|
||
android:layout_width="0dp"
|
||
android:layout_height="0dp"
|
||
android:layout_rowWeight="1"
|
||
android:layout_columnWeight="1"
|
||
android:textSize="30sp"
|
||
android:layout_margin="4dp"
|
||
app:cornerRadius="15dp"
|
||
android:text="4"
|
||
style="@style/Widget.MaterialComponents.Button.OutlinedButton"/>
|
||
|
||
<com.google.android.material.button.MaterialButton
|
||
android:id="@+id/btn5"
|
||
android:layout_width="0dp"
|
||
android:layout_height="0dp"
|
||
android:layout_rowWeight="1"
|
||
android:layout_columnWeight="1"
|
||
android:textSize="30sp"
|
||
android:layout_margin="4dp"
|
||
android:text="5"
|
||
app:cornerRadius="15dp"
|
||
style="@style/Widget.MaterialComponents.Button.OutlinedButton"/>
|
||
|
||
<com.google.android.material.button.MaterialButton
|
||
android:id="@+id/btn6"
|
||
android:layout_width="0dp"
|
||
android:layout_height="0dp"
|
||
android:layout_rowWeight="1"
|
||
android:layout_columnWeight="1"
|
||
android:textSize="30sp"
|
||
android:layout_margin="4dp"
|
||
android:text="6"
|
||
app:cornerRadius="15dp"
|
||
style="@style/Widget.MaterialComponents.Button.OutlinedButton"/>
|
||
|
||
<com.google.android.material.button.MaterialButton
|
||
android:id="@+id/btnMinus"
|
||
android:layout_width="0dp"
|
||
android:layout_height="0dp"
|
||
android:layout_rowWeight="1"
|
||
android:layout_columnWeight="1"
|
||
android:textSize="30sp"
|
||
android:layout_margin="4dp"
|
||
android:text="-"
|
||
app:cornerRadius="15dp"
|
||
style="@style/Widget.MaterialComponents.Button"/>
|
||
|
||
<!-- Row 4 -->
|
||
<com.google.android.material.button.MaterialButton
|
||
android:id="@+id/btn1"
|
||
android:layout_width="0dp"
|
||
android:layout_height="0dp"
|
||
android:layout_rowWeight="1"
|
||
android:layout_columnWeight="1"
|
||
android:textSize="30sp"
|
||
android:layout_margin="4dp"
|
||
android:text="1"
|
||
app:cornerRadius="15dp"
|
||
style="@style/Widget.MaterialComponents.Button.OutlinedButton"/>
|
||
|
||
<com.google.android.material.button.MaterialButton
|
||
android:id="@+id/btn2"
|
||
android:layout_width="0dp"
|
||
android:layout_height="0dp"
|
||
android:layout_rowWeight="1"
|
||
android:textSize="30sp"
|
||
android:layout_columnWeight="1"
|
||
android:layout_margin="4dp"
|
||
android:text="2"
|
||
app:cornerRadius="15dp"
|
||
style="@style/Widget.MaterialComponents.Button.OutlinedButton"/>
|
||
|
||
<com.google.android.material.button.MaterialButton
|
||
android:id="@+id/btn3"
|
||
android:layout_width="0dp"
|
||
android:layout_height="0dp"
|
||
android:layout_rowWeight="1"
|
||
android:textSize="30sp"
|
||
android:layout_columnWeight="1"
|
||
android:layout_margin="4dp"
|
||
android:text="3"
|
||
app:cornerRadius="15dp"
|
||
style="@style/Widget.MaterialComponents.Button.OutlinedButton"/>
|
||
|
||
<com.google.android.material.button.MaterialButton
|
||
android:id="@+id/btnPlus"
|
||
android:layout_width="0dp"
|
||
android:layout_height="0dp"
|
||
android:layout_rowWeight="1"
|
||
android:layout_columnWeight="1"
|
||
android:textSize="30sp"
|
||
android:layout_margin="4dp"
|
||
android:text="+"
|
||
app:cornerRadius="15dp"
|
||
style="@style/Widget.MaterialComponents.Button"/>
|
||
|
||
<!-- Row 5 -->
|
||
<com.google.android.material.button.MaterialButton
|
||
android:id="@+id/btn0"
|
||
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
|
||
android:layout_width="0dp"
|
||
android:layout_height="0dp"
|
||
android:layout_rowWeight="1"
|
||
android:layout_columnSpan="2"
|
||
android:textSize="30sp"
|
||
android:layout_columnWeight="2"
|
||
android:layout_margin="4dp"
|
||
app:cornerRadius="15dp"
|
||
android:text="0" />
|
||
|
||
<com.google.android.material.button.MaterialButton
|
||
android:id="@+id/btnDot"
|
||
android:layout_width="0dp"
|
||
android:layout_height="0dp"
|
||
android:layout_rowWeight="1"
|
||
android:layout_columnWeight="1"
|
||
android:textSize="30sp"
|
||
android:layout_margin="4dp"
|
||
android:text="."
|
||
app:cornerRadius="15dp"
|
||
style="@style/Widget.MaterialComponents.Button.OutlinedButton"/>
|
||
|
||
<com.google.android.material.button.MaterialButton
|
||
android:id="@+id/btnEquals"
|
||
android:layout_width="0dp"
|
||
android:layout_height="0dp"
|
||
android:layout_rowWeight="1"
|
||
android:textSize="30sp"
|
||
android:layout_columnWeight="1"
|
||
android:layout_margin="4dp"
|
||
android:text="="
|
||
app:cornerRadius="15dp"
|
||
style="@style/Widget.MaterialComponents.Button"/>
|
||
|
||
</GridLayout>
|
||
|
||
</LinearLayout> |