<?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>
Ja, ich weiß, die Größe für meine Tasten sind fest codiert, ich habe versucht, das nicht zu tun, aber es funktioniert nicht so oder so? Ich bin ein Anfänger, also bestrafe mich bitte nicht für meine Fehler, ich schätze all die Hilfe.Android Studio: Ich habe eine Tasten, die nicht auf meinem Telefon skalieren sind?
Hier sind einige Screenshots:
Dies ist in Studio ist ein Screenshot, wenn ausgeführt wird, ist ein anderer. – Willie3838