Android的设置::布局 [英] Android :: Settings Layout

查看:169
本文介绍了Android的设置::布局的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要帮助......我的错误与我的Andr​​oid XML ......这里的code:

I need help... I got errors with my android xml... Here's the code:

<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">

<CheckBoxPreference 
    android:key="music"
    android:title="Music"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:summary="Play Music for each screen"
    android:defaultValue="true" />

<CheckBoxPreference
    android:key="hints"
    android:title="Hints" 
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:summary="Enable hints during gameplay"
    android:defaultValue="true" />

</PreferenceScreen>

下面是错误信息:

com.android.layoutlib.bridge.MockView cannot be cast to android.view.ViewGroup
You must supply a layout_width attribute.
You must supply a layout_height attribute.

在此先感谢..

Thanks in advance..

推荐答案

试试这个:

<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">

    <PreferenceCategory android:title="CheckBoxPreference">

        <CheckBoxPreference
             android:key="music"
             android:title="Music"
             android:summary="Play Music for each screen"
             android:defaultValue="true" />

        <CheckBoxPreference
             android:key="hints"
             android:title="Hints" 
             android:summary="Enable hints during gameplay"
             android:defaultValue="true" />

    </PreferenceCategory> 
</PreferenceScreen>

这篇关于Android的设置::布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆