【问题标题】:RadioButton outer glow is cut off at startRadioButton 外发光在开始时被切断
【发布时间】:2021-03-31 10:05:05
【问题描述】:

这是我的电台组布局:

<RadioGroup
     android:layout_width="0dp"
     android:layout_height="match_parent"
     android:background="@color/white"
     android:orientation="horizontal">

                        <RadioButton
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_marginEnd="14dp"
                            android:text="Start" />

                        <RadioButton
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_marginEnd="14dp"
                            android:text="End" />
                    </RadioGroup>

但是当我触摸并按住第一个单选按钮时。左侧的发光效果已被切断。

我该如何解决这个问题?

【问题讨论】:

    标签: android radio-button radio-group


    【解决方案1】:

    您可以通过向 RadioGroup 添加 startPadding 或向 RadioButton 添加 startMargin 来避免这种情况。

    【讨论】:

    • 我的应用有点奇怪。 RadioGroup 中的 paddingStart 可以与其他应用一起使用,但我的应用不能?
    【解决方案2】:

    @Septimiu 的答案是正确的:startPadding 到 RadioGroup 或添加 startMargin 到 RadioButton

    <RadioGroup
        ...
        android:paddingStart="20dp"
        >
        ...
    

    但我发现我的活动出现问题:android:hardwareAccelerated 在 AndroidManifest.xml 中的活动中设置为 false

    <activity
        ..
        android:hardwareAccelerated="false"
        .. />
    

    如果设置为这个,paddingStart 将不起作用。所以我删了

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-08-14
      • 2023-02-24
      • 1970-01-01
      • 1970-01-01
      • 2018-07-03
      • 2017-05-06
      相关资源
      最近更新 更多