1

以下のように望ましい結果を得ようとしていますが、無駄です。イメージビューがテキストのように見えるが、ズーム機能を使用できるようにイメージビューとして機能するように、イメージビューをテキストにマスクする必要があります。

ここに画像の説明を入力

画像がテキストの境界線を越えてはみ出してはなりません。Glide-Transformations などをいくつか用意しましたが、うまくいきませんでした。テキストは動的で、任意の文字や単語に置き換えることができます。

編集

コード スニペットを次に示します。

Glide.with(this).load(R.drawable.eagle).override(width, height).bitmapTransform(new CenterCrop(this),

new MaskTransformation(mContext, R.drawable.mask_e)).into(Imageview);
4

1 に答える 1

-1

ImageView にテキストを追加するには、次のようにします。

<RelativeLayout> 
    <ImageView
        android:id="@+id/myImageView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/myImageSouce" />

    <TextView
        android:id="@+id/myImageViewText"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/myImageView"
        android:layout_alignTop="@+id/myImageView"
        android:layout_alignRight="@+id/myImageView"
        android:layout_alignBottom="@+id/myImageView"
        android:layout_margin="1dp"
        android:gravity="center"
        android:text="Hello"
        android:textColor="#000000" />
 </RelativeLayout>

PS。RelativeLayout 内でのみ機能します

于 2016-03-14T05:42:15.647 に答える