我在做一個應用程序與它的內部卡狀元意見的內容,但我有幾個問題:卡接口:無法適應內容和文本進行裁剪
我不能讓標籤線(藍線)遠離卡片文本。我已經嘗試了填充和邊距(從文本中的兩行圖像視圖和文本視圖),並沒有什麼似乎在這裏工作。
卡片標題的底部部分由於行距而被裁剪。我該如何解決這個問題並保持行距?
檢查這張截圖爲更好地理解:http://imgur.com/qsoCFrB
下面的代碼到卡上的背景和接口本身:
card_bg:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle"
android:dither="true">
<corners android:radius="1dp"/>
<solid android:color="#bdbdbd" />
</shape>
</item>
<item android:bottom="2dp">
<shape android:shape="rectangle"
android:dither="true">
<corners android:radius="2dp" />
<solid android:color="@android:color/white" />
<padding android:bottom="6dp"
android:left="6dp"
android:right="6dp"
android:top="4dp" />
</shape>
</item>
</layer-list>
主要胡亞蓉:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:layout_marginLeft="6dp"
android:layout_marginRight="6dp"
android:layout_marginTop="4dp"
android:background="@drawable/card_bg" >
<ImageView
android:id="@+id/iconView0001"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="6dp"
android:src="@drawable/icon_example" />
<ImageView
android:id="@+id/labelSource0001"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/cardText0001"
android:layout_marginTop="4dp"
android:background="@drawable/card_label" />
<TextView
android:id="@+id/cardTitle0001"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/cardText0001"
android:layout_toRightOf="@+id/iconView0001"
android:fontFamily="sans-serif-condensed"
android:maxLines="2"
android:paddingLeft="4dp"
android:lineSpacingExtra="-6dp"
android:text="@string/card_title_002"
android:textColor="#717171"
android:textSize="16sp" />
<TextView
android:id="@+id/cardText0001"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/iconView0001"
android:fontFamily="sans-serif"
android:layout_marginTop="4dp"
android:maxLines="1"
android:text="@string/card_desc_002"
android:textColor="#acacac"
android:textSize="12sp" />
</RelativeLayout>
</FrameLayout>
提前致謝。
它沒有在TextView padding上工作=/ RelativeLayout只有邊距,增加這些邊距或添加邊距? 關於負值,文本中的線條會更接近,因此我可以在卡片中放入更多文本 – guilhermexot
我已經使用解決方案編輯了我的答案,在查看代碼後我發現了它。我希望這是您尋找的解決方案! – iheanyi