Cardslib - 所有卡上不必要的12dp保证金保证金、不必要、卡上、Cardslib

由网友(萌萌づ)分享简介:摘要:我是新的Andr​​oid开发,并且我在卡片上用加布里埃尔马里奥蒂的优秀cardslib显示图像(.jpgs)。我希望图像覆盖,无保证金整卡。相反,我看到的图像的各方面不必要的12dp保证金。我已经试过各种事情,但我一直无法删除此保证金(换句话说,设置保证金0dp)。Summary: I’m new to An...

摘要:我是新的Andr​​oid开发,并且我在卡片上用加布里埃尔马里奥蒂的优秀cardslib显示图像(.jpgs)。我希望图像覆盖,无保证金整卡。相反,我看到的图像的各方面不必要的12dp保证金。我已经试过各种事情,但我一直无法删除此保证金(换句话说,设置保证金0dp)。

Summary: I’m new to Android development, and I’m using Gabriele Mariotti's excellent cardslib to display images (.jpgs) on cards. I want the image to cover the entire card with no margin. Instead, I’m seeing an unwanted 12dp margin on all sides of the image. I’ve tried various things, but I’ve been unable to remove this margin (in other words, set the margin to 0dp).

详细信息:我显示卡上的JPG格式。该.JPG卡上的唯一的事情(也就是没有头,没有缩略图等)的问题是,出现在卡的四周多余的空格。根据.JPG和卡的相对高宽比,在任一台顶部/底部或左/右边缘更多的空白,但在最小的空白正是12dp。

Details: I’m displaying a .jpg on a card. The .jpg is the only thing on the card (that is, no header, no thumbnail, etc.) The problem is that extra whitespace appears on all sides of the card. Depending on the relative aspect ratios of the .jpg and the card, there is more whitespace on either the top/bottom or left/right edges, but at the minimum the whitespace is exactly 12dp.

综观文档,特别是卡文档 ,似乎我应该设置之类的东西layout_marginTop和layout_marginBottom。我尝试了一些这些不同的排列,但不能删除12dp保证金。我目前的布局是这样的:

Looking at the documentation, in particular the CARD documentation, it seemed I should set things like layout_marginTop and layout_marginBottom. I tried a number of different permutations of these, but could not remove the 12dp margin. My layouts currently look like this:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_margin="0dp"
    android:layout_marginTop="0dp"
    android:layout_marginBottom="0dp"
    android:paddingLeft="0dp"
    android:paddingRight="0dp"
    android:paddingTop="0dp"
    android:paddingBottom="0dp" >

    <it.gmariotti.cardslib.library.view.CardViewNative
        android:id="@+id/carddemo"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="0dp"
        android:layout_marginTop="0dp"
        android:layout_marginBottom="0dp"
        android:paddingLeft="0dp"
        android:paddingRight="0dp"
        android:paddingTop="0dp"
        android:paddingBottom="0dp" />
</LinearLayout>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_marginTop="0dp"
    android:layout_marginBottom="0dp"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="238dp">

    <ImageView
        android:layout_marginTop="0dp"
        android:layout_marginBottom="0dp"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/imageView"/>
</LinearLayout>

(我知道很多上面的设置是多余的,不必要的或愚蠢的。之后,我找到了正确的(S)我要修剪出不必要的。)

(I realize many of the above settings are redundant, unnecessary or silly. After I found the correct one(s) I was going to prune out the unnecessary ones.)

我搜索了保证金(1命中)的计算器cardslib标签,marginTop(0人次),填充(一击),布局(25次点击),但没有找到解决方案上述任何答案。

I searched the stackoverflow "cardslib" tag for "margin" (1 hit), "marginTop" (0 hits), "padding" (1 hit), "layout" (25 hits) but didn't find the solution in any of those answers.

推荐答案

勾选此文件。

在你的情况,你可以在你的项目覆盖这些值:

In your case, you can override these values in your project:

    <dimen name="card_main_content_native_default_paddingLeft">12dp</dimen>
    <dimen name="card_main_content_native_default_paddingRight">12dp</dimen>
    <dimen name="card_main_content_native_default_paddingTop">12dp</dimen>
    <dimen name="card_main_content_native_default_paddingBottom">12dp</dimen>
阅读全文

相关推荐

最新文章