小编Jad*_* Gu的帖子

CardView在Pre-Lollipop的每个边缘都有额外的边距

这是两张照片.

在棒棒糖上: 在棒棒糖上:

在预棒棒糖上: 在前棒棒糖

我们可以看到它就在Lollipop的屏幕旁边.这就是我想要的.但在Pre-Lollipop设备上,屏幕边缘有额外的余量.你们有经验吗?谢谢.

这是布局xml:

<android.support.v7.widget.CardView
        android:id="@+id/card_title_schedule"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:layout_centerVertical="true"
        app:cardCornerRadius="0dp"
        app:cardBackgroundColor="@color/colorAccent"
        >
Run Code Online (Sandbox Code Playgroud)

android android-cardview android-5.0-lollipop

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

在Lollipop设备上使用AppCompat-21崩溃

最近我将我的nexus 5升级为Lollipop.我使用AppCompat-21创建了一个应用程序.值-v21下的样式如下

<resources>
    <style name="AppTheme" parent="android:Theme.Material.Light">
    </style>
</resources>
Run Code Online (Sandbox Code Playgroud)

但是当我运行应用程序时,它崩溃了信息:

Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
Run Code Online (Sandbox Code Playgroud)

这是我的build.gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.1"

    defaultConfig {
        applicationId "geone.businspector"
        minSdkVersion 11
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:21.0.0'
}
Run Code Online (Sandbox Code Playgroud)

它在Lollipop之前的设备下运行良好......

我google了很多,并没有很好的解决方案.以前有人见过这个吗?ps:我使用的是Android Studio 0.8.14,而且我是Android Studio的新手.谢谢.

android android-appcompat android-studio build.gradle android-5.0-lollipop

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