【问题标题】:MaterialButtonToggleGroup remove default borderMaterialButtonToggleGroup 移除默认边框
【发布时间】:2021-08-10 04:22:09
【问题描述】:

我是 android 开发新手,我需要一些帮助来删除 MaterialButtonToggleGroup 的边框。

任何帮助表示赞赏

编辑

    android:layout_width="match_parent"
    android:layout_height="45dp"
    android:layout_below="@+id/companyName"
    android:layout_centerInParent="true"
    app:checkedButton="@id/btnAll"
    app:singleSelection="true"
    app:selectionRequired="true"
    android:gravity="center"
            >

    <com.google.android.material.button.MaterialButton
        android:id="@+id/btnAll"

        app:cornerRadius="0dp"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textSize="13sp"
        android:text="All"
        android:gravity="center_vertical|end"
        android:paddingRight="15dp"

      

        />

    <com.google.android.material.button.MaterialButton
        android:id="@+id/btnProgram"
        app:cornerRadius="0dp"
        style="@style/ToggleButtonGroupStyle"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:gravity="center_vertical"
        android:paddingRight="15dp"



        android:textSize="13sp"
         />
</com.google.android.material.button.MaterialButtonToggleGroup>

【问题讨论】:

  • 你能发布你的布局吗
  • 我已经用代码编辑了帖子

标签: java android xml android-button materialbutton


【解决方案1】:

将此添加到按钮 xml:

android:stateListAnimator="@null" 

更多信息:https://stackoverflow.com/a/31003693/10277150

【讨论】:

  • 有没有办法保留底部边框,但只删除顶部,谢谢你完美的工作。
  • 请试试这个:android:outlineProvider="bounds" 并检查链接:[link]stackoverflow.com/questions/27477371/…
【解决方案2】:

在您的 MaterialButton 中使用 strokeWidth 属性:

       <com.google.android.material.button.MaterialButton
            style="?attr/materialButtonOutlinedStyle"
            app:strokeWidth="0dp"

【讨论】:

    猜你喜欢
    • 2013-05-14
    • 1970-01-01
    • 2021-06-20
    • 1970-01-01
    • 2015-07-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多