相关疑难解决方法(0)

Android的XML属性中的问号(?)

谁能解释Android XML属性中的问号意味着什么?

<TextView    
    style="?android:attr/windowTitleStyle"
    More attributes
/>
Run Code Online (Sandbox Code Playgroud)

xml android android-styles

134
推荐指数
2
解决办法
3万
查看次数

Android样式:'style ="@ android:style/XYZ"'和'style ="?android:attr/XYZ"'之间的区别?

我试图将按钮样式设置为我在Android Full Width ICS样式Minimalist Bottom ButtonsViews中询问的那些.

我成功了,对于任何感兴趣的人都有以下xml:

<LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="bottom"
        android:divider="@android:drawable/divider_horizontal_dark"
        android:gravity="bottom"
        android:orientation="vertical"
        android:paddingTop="16dip"
        android:showDividers="beginning|end" >

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:measureWithLargestChild="true"
            android:orientation="horizontal"
            android:divider="@android:drawable/divider_horizontal_dark"
            android:showDividers="middle" >                             


            <Button
                android:id="@+id/cancel_button"
                style="?android:attr/buttonBarButtonStyle"
                android:layout_width="0dip"
                android:layout_height="wrap_content"
                android:layout_gravity="left"
                android:layout_weight="1"
                android:maxLines="2"
                android:text="@string/cancel_button" />

            <Button
                android:id="@+id/login_button"
                style="?android:attr/buttonBarButtonStyle"
                android:layout_width="0dip"
                android:layout_height="wrap_content"
                android:layout_gravity="right"
                android:layout_weight="1"
                android:filterTouchesWhenObscured="true"
                android:maxLines="2"
                android:text="@string/login_button" />

        </LinearLayout>
    </LinearLayout>
Run Code Online (Sandbox Code Playgroud)

但有一个问题.eclipse内容辅助不知道以下资源解析发生了什么:

style="?android:attr/buttonBarButtonStyle"

我熟悉典型的分辨率(eclipse的内容辅助知道)

style=@android/style/...

......但我不清楚两者之间的区别.似乎某些样式属性出现在一个而不是另一个.例如,以下内容无法解决任何问题:

style=@android:attr/buttonBarStyle

这两个都没有:

style="@android:style/buttonBarStyle

所以我想这里有两个问题:

  1. 为什么资源引用语法有所不同?
  2. 为什么在attr类别下混淆样式的错误分类.
  3. 什么是attr类别甚至再次使用?

谢谢!

android android-layout android-resources android-styles

13
推荐指数
1
解决办法
1万
查看次数

@android:和android之间有什么区别?

有什么区别

android:color="@android:color/black"
Run Code Online (Sandbox Code Playgroud)

style="?android:attr/borderlessButtonStyle" 
Run Code Online (Sandbox Code Playgroud)

@和之间有什么区别?

这是ungoogleable或ogooglebar的问题之一.

android android-layout android-xml

7
推荐指数
2
解决办法
3073
查看次数

Android 风格语法@android vs android

之间有什么区别

<style name="AppTheme" parent="android:Theme.Holo.Light">
    <item name="android:actionBarStyle">@style/MyActionBar</item>
</style>
Run Code Online (Sandbox Code Playgroud)

<style name="AppTheme" parent="@android:style/Theme.Holo.Light">
    <item name="android:actionBarStyle">@style/MyActionBar</item>
</style>
Run Code Online (Sandbox Code Playgroud)

注意 using@android:style/和 just using的父语法的不同android:

我已经在 android 布局 xml 文件中看到了“?android:”和“@android:”之间的区别是什么?但请注意,我的示例不包含问号。

xml android android-styles

5
推荐指数
1
解决办法
647
查看次数