左は自分のアプリを見たい、アンドロイドのスタジオのプレビューの仕組みです。画像がCardViewの上部に揃えられます。CardViewの上に隙間が残る
は実際にどのように見えるかです。ギャップを置いて。
リニアレイアウトと相対レイアウトの両方で試しました。動作しません。ここ は私のコードです:
EDIT:
<android.support.v7.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/testCardView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/medium_margin"
android:layout_marginRight="@dimen/medium_margin"
android:animateLayoutChanges="true"
app:cardCornerRadius="3dp"
app:cardUseCompatPadding="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:id="@+id/fullCardLayout"
android:layout_width="match_parent"
android:layout_height="@dimen/reward_card_height"
android:orientation="horizontal"
android:paddingLeft="@dimen/medium_margin"
>
<ImageView
android:id="@+id/imgProvider"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/tiny_margin"
android:src="@mipmap/rewards_amazon_icon"/>
.........
ImageViewに余白を設定しようとしましたか? –
あなたはすべてのXMLを投稿できますか? –
何らかの理由でそれがCardViewを含んでいませんでした。 最初から画像ビュー部分まで投稿しました。 – TalDroid