2017-06-16 2 views
1

私はこの上にタイトルのある画像と、次にいくつかのデータと、多分以下のいくつかのアクションボタンを持つこのカードに似たカードビューを再作成しようとしています。しかし、私の人生では、テキストをイメージの上に置くことはできません。ここで enter image description herexamarinカードの表示レイアウト

私がこれまで

<?xml version="1.0" encoding="utf-8"?> 
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:cardview="http://schemas.android.com/apk/res-auto" 
android:id="@+id/card_view" 
android:layout_width="match_parent" 
android:layout_height="325dp" 
android:layout_margin="8dp"> 
<RelativeLayout 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 
    <ImageView 
     android:id="@+id/image1" 
     android:layout_width="match_parent" 
     android:layout_height="230dp" 
     android:layout_alignParentTop="true" 
     android:scaleType="centerCrop" /> 
    <TextView 
     android:id="@+id/recipeName" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_below="@+id/image1" 
     android:maxLines="3" 
     android:padding="8dp" 
     android:text="name" 
     android:textColor="#222" 
     android:textStyle="bold" 
     android:textSize="22dp" /> 
    <TextView 
     android:id="@+id/description" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_below="@+id/recipeName" 
     android:maxLines="3" 
     android:padding="8dp" 
     android:text="description" 
     android:textColor="#666" 
     android:textSize="14dp" /> 
    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:orientation="horizontal" 
     android:layout_below="@+id/description"> 
     <TextView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_below="@+id/recipeName" 
      android:maxLines="3" 
      android:padding="8dp" 
      android:text="View" 
      android:textColor="#666" 
      android:textSize="14dp" /> 
     <TextView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_below="@+id/recipeName" 
      android:maxLines="3" 
      android:padding="8dp" 
      android:text="Add" 
      android:textColor="#666" 
      android:textSize="14dp" /> 
    </LinearLayout> 
</RelativeLayout> 

+1

テキストビューのレイヤーを意味しますか?より良い印象を得るためにあなたのアプリからのスクリーンショットを私たちに与えることができますか? –

答えて

2

私はあなたが@+id/image1の上に@+id/recipeNameをしたいと仮定しますしているものです。 recipeName

、あなたが設定されている:android:layout_below="@+id/image1"要素image1以下のレイアウトであろう。あなたはその要素の下にそれをしたくないので、その行を削除してください。試してくださいandroid:layout_alignBottom="@+id/image1"。ほとんどの事を行うのに十分なレイアウトパラメータがあります。LayoutParams、あなたは複雑なレイアウトをやって始めると、それはウサギの穴のビットかも知れません...

はまた、あなたはないでしょう、あなたのLinearLayout内の要素にlayout_belowを持っています何でもする。

+0

はい、画像の下部にレシピ名を入力しようとしています。あなたが言及したさまざまなレイアウトパラメータをチェックします。ありがとう。 –

+0

これはトリックでした。再度、感謝します。 –

関連する問題