相关疑难解决方法(0)

android布局xml文件中"?android:"和"@android:"之间有什么区别?

android布局xml文件中"?android:"和"@android:"之间有什么区别?它们似乎是重用android SDK资源的可互换方式.

我发现的唯一区别由以下示例说明.

这里TextView的右边缘与ImageButton的左边缘对齐

 <RelativeLayout
    android:id="@id/header"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="#888888">
    <TextView
        android:id="@android:id/text1"
        android:layout_alignParentLeft="true"
        android:text="blah blah"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_toLeftOf="@android:id/button1" />
    <ImageButton
        android:id="@android:id/button1"
        android:layout_alignParentRight="true"
        style="@style/PlusButton" />
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

但是,TextView的右边缘与RelativeLayout的右边缘对齐.TextView与ImageButton重叠.

<RelativeLayout
    android:id="@id/header"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="#888888">
    <TextView
        android:id="@android:id/text1"
        android:layout_alignParentLeft="true"
        android:text="blah blah"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_toLeftOf="?android:id/button1" />
    <ImageButton
        android:id="?android:id/button1"
        android:layout_alignParentRight="true"
        style="@style/PlusButton" />
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

两种布局之间的唯一区别是使用@android vs?android.两者都编译没有错误.

非常感谢.

layout android reference

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

Android全宽ICS风格极简主义底部按钮视图

我想制作一些如下所示的按钮: ICS按钮

我在android.widget包中看起来很难预设ICS,但我找不到任何东西.我认为必须有一个简单的方法,因为它们似乎是整个操作系统版本的主题.如果有人知道如何使按钮看起来像这些我会是一个快乐的露营者.

android android-widget android-layout android-4.0-ice-cream-sandwich

6
推荐指数
1
解决办法
6594
查看次数