导航抽屉使用Appcompat V7 - 问题与Android:ATTR标签?抽屉、标签、问题、Appcompat

由网友(迷人的小混蛋)分享简介:我是用我的项目的动作条和导航抽屉。使用appcompat V7和V4。我已经添加了资源appcompat V7。下面是我的TextView从在的创建导航抽屉 底部的三条线都导致我的应用程序失败,它建立好了,但我得到一个强制关闭,我不知道如何解决这个问题。我不明白为什么没有被发现的属性,考虑到我加入其资源的appcomp...

我是用我的项目的动作条和导航抽屉。使用appcompat V7和V4。

我已经添加了资源appcompat V7。

下面是我的TextView从在的创建导航抽屉

底部的三条线都导致我的应用程序失败,它建立好了,但我得到一个强制关闭,我不知道如何解决这个问题。我不明白为什么没有被发现的属性,考虑到我加入其资源的appcompat。或者他们没有有效的appcompat什么?

MinSDK版本为10,并在其中code失败。以上API 10 code正常工作。

 < TextView中的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
    机器人:ID =@机器人:ID / text1中
    机器人:layout_width =match_parent
    机器人:layout_height =WRAP_CONTENT
    机器人:重力=center_vertical
    机器人:以下属性来=16DP
    机器人:paddingRight =16DP
    机器人:文字颜色=#FFF
    机器人:textAppearance =机器人:ATTR / textAppearanceListItemSmall
    机器人:背景=机器人:ATTR / activatedBackgroundIndicator
    机器人:=了minHeight:/>中的Andr​​oid ATTR /列表preferredItemHeightSmall?
 

解决方案

我有同样的问题。据我了解旧的API已不是predefined textAppearanceListItemSmall,activatedBackgroundIndicator和列表preferredItemHeightSmall。所以,如果你需要,你可以指定自己的价值观或删除此行,靠你的运气了。

I am using an actionbar and navigation drawer in my project. Using appcompat v7 and v4.

android 新建项目时 appcompat v7报错

I have added the appcompat v7 WITH resources.

The following is my textview for the navigation drawer list taken straight from the android sample app found at Creating a Navigation Drawer

The bottom three lines all cause my application to fail, it builds okay, but I get a force close and I am not sure how to solve the problem. I don't understand why the attributes are not being found, considering I added the appcompat with its resources. Or are they not valid with the appcompat or something?

MinSDK Version is 10 and at which the code fails. Above API 10 the code works fine.

<TextView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@android:id/text1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"        
    android:gravity="center_vertical"
    android:paddingLeft="16dp"
    android:paddingRight="16dp"
    android:textColor="#fff"
    android:textAppearance="?android:attr/textAppearanceListItemSmall"
    android:background="?android:attr/activatedBackgroundIndicator"
    android:minHeight="?android:attr/listPreferredItemHeightSmall"/>

解决方案

I had same issue. As i understand older apis haven't predefined textAppearanceListItemSmall, activatedBackgroundIndicator and listPreferredItemHeightSmall. So if you need you can specify your own values or remove this lines and rely on your luck.

阅读全文

相关推荐

最新文章