问题描述
所以我想改变android studio中按钮的形状。我已经尝试并遵循了多个指南,但似乎没有任何效果。我想我在其他一些文件中搞砸了一些东西,比如主题。
我试过这个https://stackoverflow.com/a/18879660/14973568 和https://www.youtube.com/watch?v=plQIpqBcdQE 并且 This was the last attempt at resolving the problem
图中代码:
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#F4CD47"/>
<corners android:topRighTradius="120dp"
android:topLefTradius="120dp"
android:bottomLefTradius="120dp"
android:bottomrighTradius="120dp" />
</shape>
但我只能用 backgroundTint
更改它。
rounded_button.xml:
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#fff" />
<corners android:radius="130dp" />
</shape>
activity_game.xml:
<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=".game"
android:background="#396dbf">
<TextView
android:id="@+id/credit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:layout_marginBottom="16dp"
android:text="@string/creditText"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<ImageView
android:id="@+id/backButton"
android:layout_width="56dp"
android:layout_height="56dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/back"
android:contentDescription="Todo" />
<ImageView
android:id="@+id/logo"
android:layout_width="100dp"
android:layout_height="85dp"
android:layout_marginTop="4dp"
android:layout_marginEnd="16dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/logo" />
<Button
android:id="@+id/button1"
android:layout_width="276dp"
android:layout_height="56dp"
android:layout_marginTop="380dp"
android:background="@drawable/rounded_button"
android:backgroundTint="#FFE500"
android:fontFamily="sans-serif-black"
android:textColor="#000000"
android:textSize="14sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.496"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/button2"
android:layout_width="276dp"
android:layout_height="56dp"
android:layout_marginTop="40dp"
android:backgroundTint="#FFE500"
android:fontFamily="sans-serif-black"
android:textColor="#000000"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.496"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/button1" />
<Button
android:id="@+id/button3"
android:layout_width="276dp"
android:layout_height="56dp"
android:layout_marginTop="40dp"
android:backgroundTint="#FFE500"
android:fontFamily="sans-serif-black"
android:textColor="#000000"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.496"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/button2" />
<TextView
android:id="@+id/question"
android:layout_width="245dp"
android:layout_height="173dp"
android:layout_marginTop="132dp"
android:layout_marginEnd="80dp"
android:background="@drawable/whiteback"
android:text="TextView"
android:textAlignment="center"
android:textAllCaps="false"
android:textColor="#000000"
android:textSize="18sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)