<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout_one"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.william.calculator2.MainActivity">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/grey">
<TextView
android:layout_weight="2"
android:id="@+id/text"
android:layout_width="match_parent"
android:textSize="50sp"
android:gravity="center"
android:textColor="@color/colorPrimary"
android:layout_height="0dp"
android:background="@color/white"
android:text="@string/one" />
<Button
android:layout_marginTop="20dp"
android:id="@+id/button_1"
android:background="@drawable/plus"
android:layout_width="80dp"
android:layout_height="0dp"
android:layout_marginLeft="10dp"
android:layout_weight="1"
android:onClick="setSubtractionOperator"/>
<Button
android:id="@+id/button_2"
android:background="@drawable/minus"
android:layout_marginTop="20dp"
android:layout_weight="1"
android:layout_marginLeft="10dp"
android:layout_width="80dp"
android:layout_height="0dp" />
<Button
android:layout_weight="1"
android:id="@+id/button_3"
android:background="@drawable/one"
android:layout_marginTop="20dp"
android:layout_marginLeft="10dp"
android:layout_width="80dp"
android:layout_height="0dp"
android:onClick="useNumber1"/>
<Button
android:layout_weight="1"
android:id="@+id/button_4"
android:layout_marginLeft="10dp"
android:background="@drawable/roundedbutton"
android:layout_marginTop="20dp"
android:layout_marginBottom="20dp"
android:layout_width="wrap_content"
android:layout_height="0dp" />
</LinearLayout>
</RelativeLayout>
네, 제 단추의 크기가 하드 코드되었음을 알고 있습니다. 그러지 않으려 고 노력했지만 어떤 방법으로도 작동하지 않습니다. 나는 초보자이기 때문에 제 실수에 대해 제발 벌점을주지 마십시오. 모든 도움에 감사드립니다. 에있어서 button_1의 onclick을, 당신은 "SetSubstractionOperator"같은 이름의 레이아웃과의 방법을 이름을 지정해야합니다, 당신의 MainActivity에서Android Studio : 휴대 전화에서 크기가 조절되지 않는 버튼이 있습니까?
이것은 Studio에서 하나의 스크린 샷입니다. 실행하면 또 다른 것입니다. – Willie3838