Cardlib - junk margin 12dp on all cards

Synopsis: Im new to android development and I use Gabriele Mariotti excellent maps to display images (.jpg) on ​​cards. I want the image to cover the whole borderless map. Instead, I'm seeing an unwanted 12dp edge from all sides of the image. I've tried different things, but I've been unable to remove this margin (in other words, set the margin to 0dp).

Details: Im displaying .jpg on the map..jpg is the only one on the map (i.e. no title, no thumbnails, etc.). The problem is extra gaps appear on all sides of the map. Depending on the relative aspect ratio of the .jpg and the map, there are more spaces on the top / bottom or left / right edges, but at least 12dp spaces.

Looking at the documentation, specifically the CARD documentation , it seemed to me that I should be setting things like layout_marginTop and layout_marginBottom. I tried several different permutations of them but was unable to remove the 12dp marker. Currently my layouts 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>

      

and

<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>

      

(I realize that many of the above settings are redundant, unnecessary, or silly. After I found the correct one (I), I was going to cut down on the unnecessary ones.)

I've searched the stackoverflow "cardlib" tag for "margin" (1 hit), "marginTop" (0 hit), "padding" (1 hit), "layout" (25 hits) but couldn't find a solution in any of these answers.

+1


source to share


1 answer


Check this file .

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>

      

+3


source







All Articles