相关疑难解决方法(0)

定义自定义attrs

我需要实现自己的属性,如in com.android.R.attr

在官方文档中找不到任何内容,因此我需要有关如何定义这些attrs以及如何在我的代码中使用它们的信息.

android android-resources android-attributes

449
推荐指数
4
解决办法
23万
查看次数

找不到包'com.app ....'中属性''的资源标识符

我已经从eclipse导入了一个项目到Android工作室.它使用自定义视图:

xmlns:app="http://schemas.android.com/apk/res-auto"
Run Code Online (Sandbox Code Playgroud)

我从activity_ro.xml文件中获得以下行中的错误,如:

"错误:(136)在'com.app.xxxx'包中找不到属性'pstsTabPaddingLeftRight'的资源标识符"

app:pstsDividerColor="#00000000"
app:pstsIndicatorColor="#FF33B5E6"
app:pstsTabPaddingLeftRight="14dip"
app:pstsUnderlineColor="#FF33B5E6" />
Run Code Online (Sandbox Code Playgroud)

我不确定自定义视图对于gradle是否有所不同,或者我做错了什么.有人有想法吗?

android android-custom-view android-view android-studio

51
推荐指数
2
解决办法
12万
查看次数

AdMob:缺少必需的XML属性adUnitID

我是广告新手,我无法让它发挥作用.我已经完成了http://code.google.com/intl/nl-NL/mobile/ads/docs/android/banner_xml.html上的说明.

这是我的main.xml:

<TableLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:ads="com.niek.runningapp"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical"
    android:background="#FFFFFF"
    android:stretchColumns="1">
<!-- more stuff-->
    <TableRow
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">

        <com.google.ads.AdView
            android:id="@+id/adView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            ads:adUnitId="a14da18492dd1f0"
            ads:adSize="BANNER" />
    </TableRow>
<!-- More stuff -->
Run Code Online (Sandbox Code Playgroud)

这是res/values中的attrs.xml:

<?xml version="1.0" encoding="utf-8"?>
<resources>
  <declare-styleable name="com.google.ads.AdView">
      <attr name="adSize">
          <enum name="BANNER" value="1"/>
          <enum name="IAB_MRECT" value="2"/>
          <enum name="IAB_BANNER" value="3"/>
          <enum name="IAB_LEADERBOARD" value="4"/>
      </attr>
      <attr name="adUnitId" format="string"/>
  </declare-styleable>
</resources>
Run Code Online (Sandbox Code Playgroud)

运行应用程序时发生以下错误:

XML布局中的adSize参数无效:-1.违反了BANNER

AdView缺少必需的XML属性adUnitId.

我究竟做错了什么?

android identifier admob

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

错误:在http://developer.android.com的自定义视图中找不到属性的资源标识符

我正在学习如何按照http://developer.android.com上的教程开发android应用程序.

现在我正在开发http://developer.android.com/training/custom-views/create-view.html,当我构建应用程序时,我得到错误:

D:\sviluppo\netbeans\custom-view\res\layout\main.xml:24: error: No resource identifier found for attribute 'showText' in package 'com.example.android.customviews.charting'
D:\sviluppo\netbeans\custom-view\res\layout\main.xml:24: error: No resource identifier found for attribute 'labelHeight' in package 'com.example.android.customviews.charting'
D:\sviluppo\netbeans\custom-view\res\layout\main.xml:24: error: No resource identifier found for attribute 'labelWidth' in package 'com.example.android.customviews.charting'
D:\sviluppo\netbeans\custom-view\res\layout\main.xml:24: error: No resource identifier found for attribute 'labelY' in package 'com.example.android.customviews.charting'
D:\sviluppo\netbeans\custom-view\res\layout\main.xml:24: error: No resource identifier found for attribute 'labelPosition' in package 'com.example.android.customviews.charting'
D:\sviluppo\netbeans\custom-view\res\layout\main.xml:24: error: No resource identifier found for attribute 'highlightStrength' in package 'com.example.android.customviews.charting'
D:\sviluppo\netbeans\custom-view\res\layout\main.xml:24: error: …
Run Code Online (Sandbox Code Playgroud)

android

2
推荐指数
1
解决办法
4593
查看次数