【发布时间】:2011-12-07 07:56:15
【问题描述】:
我正在尝试在 Android 2.2 项目中使用 Fragments 和 ActionBar。使用“?android:attr/actionBarSize”时出现错误,如何正确获取和设置该值?
例子:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/frags">
<fragment class="com.example.android.hcgallery.TitlesFragment"
android:id="@+id/frag_title"
android:visibility="gone"
android:layout_marginTop="?android:attr/actionBarSize"
android:layout_width="@dimen/titles_size"
android:layout_height="match_parent" />
<fragment class="com.example.android.hcgallery.ContentFragment"
android:id="@+id/frag_content"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
错误:未找到与给定名称匹配的资源(位于“layout_marginTop”,值为“?android:attr/actionBarSize”)。
【问题讨论】:
-
您找到解决方案了吗?谢谢老兄!
标签: android android-layout android-compatibility