Android:在按钮内画一个圆圈

我需要在按钮内创建一个圆圈,就像您将在下一张图片中看到的一样:

Android:在按钮内画一个圆圈

但我的问题是我已经在使用按钮的背景属性以下列方式添加漂亮的阴影效果: android:background="@android:drawable/dialog_holo_light_frame"

所以我想我不能同时使用背景。

这是我的按钮目前的样子:

Android:在按钮内画一个圆圈

关于如何获得两者的任何想法,同样漂亮的阴影效果和一个圆圈?也许可以使用“样式”属性? (不知道)

aappww 回答:Android:在按钮内画一个圆圈

你可以像这样使用 CardView:

protected virtual void _(Events.FieldUpdated<TaxRev,TaxRev.startDate> e)

   {

  var setup = PXGraph.CreateInstance<TXSetupMaint>();
  var TXSetupEX = setup.GetExtension<PX.Objects.TX.TXSetupExt>(setup);

  var rateObj = GetValues(e.Row.TaxID,TXSetupEX.Usrapikey);
  decimal rate;

  var tryRate = (Decimal.TryParse(rateObj.rate.combined_rate,out rate));
  row.TaxRate = (decimal)rate * (decimal)100;
  row.TaxBucketID = 1;

  }

round_button.xml

<com.google.android.material.card.MaterialCardView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_margin="20dp"
        app:cardCornerRadius="5sp"
        app:cardElevation="10dp"
        app:strokeColor="@color/black"
        app:strokeWidth="1dp">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_margin="10dp"
            android:orientation="vertical">

            <TextView
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_marginBottom="10dp"
                android:gravity="center"
                android:text="Test"
                android:textColor="@color/black"
                android:textSize="20sp" />

            <Button
                android:layout_width="50dp"
                android:layout_height="50dp"
                android:background="@drawable/round_button"
                android:gravity="center_vertical|center_horizontal"
                android:text="1"
                android:textColor="#fff" />
        </LinearLayout>

</com.google.android.material.card.MaterialCardView>

enter image description here

本文链接:https://www.f2er.com/20420.html

大家都在问