相关疑难解决方法(0)

缺少风格.是否为此布局选择了正确的主题?

缺少风格.是否为此布局选择了正确的主题?使用布局上方的主题组合框选择不同的布局,或修复主题样式引用.无法mapViewStyle在当前主题中找到样式.

我尝试了所有可用的解决方案来解决这个问题但似乎没有任何效果.我在清单文件中包含了库.我甚至创建了样式是styles.xml,我也选择了Google Apis构建目标.

有人可以给我一个解决方案.提前感谢您宝贵的时间.

这是我的xml文件:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
style="@style/AppTheme"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >


 <com.google.android.maps.MapView
     android:id="@+id/themap"
     style="@style/mapViewStyle"
     android:layout_width="fill_parent"
     android:layout_height="fill_parent"
     android:apiKey="here i have my key"
     android:clickable="true"
     android:enabled="true" />

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

这是我的清单片段:

  <uses-library android:name="com.google.android.maps" />

    <activity
        android:name=".MainActivity"
        android:label="@string/title_activity_main" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity android:name=".Second" />

    <activity android:name=".Third"  android:theme="@android:style/Theme.Black"/>
  </application>
Run Code Online (Sandbox Code Playgroud)

这是我的style.xml文件

<resources>
    <style name="mapViewStyle" parent="@android:style/Theme.Black">
    </style>
</resources>
Run Code Online (Sandbox Code Playgroud)

android

163
推荐指数
5
解决办法
20万
查看次数

PowerMock:模拟私有静态最终变量,一个具体的例子

通过此测试必须完成的绝对最小模拟是什么?

码:

class PrivateStaticFinal {
    private static final Integer variable = 0;
    public static Integer method() { return variable + 1; }
}
Run Code Online (Sandbox Code Playgroud)

测试:

@RunWith(PowerMockRunner.class)
@PrepareForTest(PrivateStaticFinal.class)
class PrivateStaticFinalTest {
    @Test
    public void testMethod() {
        //TODO PrivateStaticFinal.variable = 100
        assertEquals(PrivateStaticFinal.method(), 101);
    }
}
Run Code Online (Sandbox Code Playgroud)

相关:测试类中的Mock私有静态最终变量(没有明确答案)

powermock

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

标签 统计

android ×1

powermock ×1