2016-11-07 16 views
0

下の画像に示すように、各行/カードビューに「Sale」と表示されたリボンスタイルのリサイクルビューを作成します。私はすでにrecyclerviewを作成してデータを入力しています。 "セール"リボンだけが来ていません。Android - リサイクルビューの行の上にリボンを作成しますか?

どうすればよいですか?

enter image description here

+0

試し 'ビュー#setForeground(Drawableのフォアグラウンド)' – pskink

+0

がなぜこの質問を得ているので、多くのdownvotes:このよう ?私はこれが絶対にプログラミングの問題だと思う。これがプログラミングに関する質問ではない場合、どうすれば誰かがAndroidでそれを行うことができますか? –

答えて

0

あなたはこの作業のためにRelativeLayoutを使用する必要があります。

カードのコンテンツをLinearLayout(今度はコンテンツの表示を見る)に入れ、layout_marginとします。次に、このコンテンツビューをRelativeLayoutに入れ、販売リボンをImageView子要素として追加します。

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_margin="20dp" 
     android:background="@color/white"> 
     __content_of_the_card__ 
    </LinearLayout> 

    <ImageView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:src="@drawable/ribbon"/> 

</RelativeLayout> 
関連する問題