
回复
添加资源
添加资源将有机会获得更多曝光,你也可以直接关联已上传资源 去关联
今天来分享一下如何设置组件不同状态下的背景颜色,这里我定义了一个Ability,布局页面放了一个按钮和单选按钮代码如下
<?xml version="1.0" encoding="utf-8"?>
<DirectionalLayout
xmlns:ohos="http://schemas.huawei.com/res/ohos"
ohos:height="match_parent"
ohos:width="match_parent"
ohos:orientation="vertical">
<RadioButton
ohos:id="$+id:radChoose"
ohos:height="50vp"
ohos:width="match_content"
ohos:text_size="30vp"
ohos:background_element="gray"
ohos:text="选我吧"/>
<Button
ohos:id="$+id:btnDisable"
ohos:height="match_content"
ohos:width="match_content"
ohos:text="禁用"
ohos:text_size="30vp"
ohos:background_element="gray"/>
</DirectionalLayout>