gpt4 book ai didi

Android复合按钮通过xml文件

转载 作者:太空狗 更新时间:2023-10-29 15:39:28 25 4
gpt4 key购买 nike

我正在尝试使用 android 的内置控件 CompoundButton,但是我没有在 xml 中使用它,这是我的代码

<CompoundButton
android:id="@+id/mini_recorder_play"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_weight="1"
android:background="@drawable/play_d" />

它在膨胀时抛出异常。

最佳答案

CompoundButton 是一个抽象类,不能直接实例化。您必须实例化其子类之一(例如 CheckBoxRadioButtonToggleButton),或者如果这些小部件都不适合您,则创建您自己的自定义子类需要。

HTH

关于Android复合按钮通过xml文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8080984/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com