小编ash*_*ash的帖子

错误:属性"主题"已定义

我正在使用Android studio来构建应用程序.我正在使用以下依赖项:

  1. 游戏服务: compile 'com.google.android.gms:play-services:5.2.08'
  2. app fight v7: compile 'com.android.support:appcompat-v7:21.0.0'
  3. 支持Cardview: compile 'com.android.support:cardview-v7:21.0.0'
  4. 支持Recycler视图: compile 'com.android.support:recyclerview-v7:21.0.0'

我在构建应用程序时遇到以下错误:

app/build/intermediates/exploded-aar/com.google.android.gms/play-services/5.2.08/res/values/wallet_attrs.xml
    Error:Attribute "theme" has already been defined
Run Code Online (Sandbox Code Playgroud)

代码Styles.xml

<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <!-- Customize your theme here. -->
    </style>

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

代码wallet_attrs.xml

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2014 Google Inc. All Rights Reserved. -->
<resources>
    <!-- Attributes for the WalletFragment &lt;fragment&gt; tag -->
    <declare-styleable name="WalletFragmentOptions">
        <!-- Theme to be used for the Wallet selector -->
        <attr name="theme" format="enum">
            <enum …
Run Code Online (Sandbox Code Playgroud)

android compiler-errors android-theme google-play-services android-recyclerview

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

C++:理解"this"指针

我想了解"这个"指针.我认为"this"指针指的是类对象的值.但是,在下面的代码中,我可以看到"this"指针的不同值:

#include <stdio.h>

class InterfaceA{
public:
    virtual void funa() = 0;
};

class InterfaceB{
public:
    virtual void funb() = 0;
};

void globala(InterfaceA* obj){
    printf("globalA: pointer: %p\n\r",obj);
}
void globalb(InterfaceB* obj){
    printf("globalB: pointer: %p\n\r",obj);
}
class concrete : public InterfaceA, public InterfaceB{
public:
    void funa(){
        printf("funa: pointer: %p\n\r",this);
        globala(this);
        globalb(this);
    }

    void funb(){
        printf("funb: pointer: %p\n\r",this);
        globala(this);
        globalb(this);
    }
};

int main(int argc, char *argv[])
{
    concrete ac;
    ac.funa();
    ac.funb();
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

该计划的输出给出:

funa: pointer: 0x7ffff67261a0
globalA: pointer: 0x7ffff67261a0 …
Run Code Online (Sandbox Code Playgroud)

c++ pointers this

7
推荐指数
1
解决办法
412
查看次数

C++ 11自动变量:float array vs auto

声明的浮点数组的大小是suing auto与实际大小不同.为什么会这样?

例如:

宣言:

float duto[] = {2.2222f,2.223f,34.5f,1.0f,9.0f};
auto dutot = {2.2222f,2.223f,34.5f,1.0f,9.0f};
Run Code Online (Sandbox Code Playgroud)

尺寸打印:

std::cout << " float array size v: " << sizeof(duto)<<std::endl;
std::cout << " auto v: " << sizeof(dutot)<<std::endl;
Run Code Online (Sandbox Code Playgroud)

输出:

float array size v: 20
auto v: 16
Run Code Online (Sandbox Code Playgroud)

c++ auto c++11

3
推荐指数
1
解决办法
189
查看次数