でイメージを繰り返し、RelativeLayout
にします。ビットマップxmlを使用して、tilemode "repeat"
をRelativeLayout
と使用することは可能ですか?私はインターネット上で何を見てきたのか、彼らはすべてLinearLayout
を扱っています。RelativeLayoutでImageViewを使用してイメージを繰り返します
ご意見やご指摘をお待ちしております。
でイメージを繰り返し、RelativeLayout
にします。ビットマップxmlを使用して、tilemode "repeat"
をRelativeLayout
と使用することは可能ですか?私はインターネット上で何を見てきたのか、彼らはすべてLinearLayout
を扱っています。RelativeLayoutでImageViewを使用してイメージを繰り返します
ご意見やご指摘をお待ちしております。
背景として上記のXMLを追加するには、相対的なレイアウトではDrawableのフォルダ
background.xml
<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/imagename"
android:tileMode="repeat" />
に背景という名前のXMLファイルを作成します
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/background" />
はい、可能です。あなたの繰り返しイメージをのバックグラウンドとして使用して、android:tileMode="repeat"
をXMLとしてDrawable (bitmap)
と定義します。
コースのはい、相対レイアウトで使用できます。 RelativeLayoutの背景として使用します。私は自分のプロジェクトでも使っていました。
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="@drawable/top_header_bg_repeat"
android:gravity="center">
top_header_bg_repeat.xml (in drawable folder)
----------------------------------------------
<bitmap
xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/top_header"
android:tileMode="repeat"
android:dither="true"/>
Set Bitmap in ImageView
----------------------
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="@drawable/top_header_bg_repeat"
android:scaleType="fitXY"/>
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/top_header_bg_repeat"/>
相対レイアウト内に配置されたimageViewを使用してイメージを繰り返したい これを実行しましたが、機能しませんでした –
Imageviewでそのビットマップを使用しますか? –
はいビットマップを画像表示のソースとして使用したい場合 –
すべての要求において、画像が大きくてレイアウトが小さく、画像がサイズ変更されず、Xだけ繰り返す場合、小さな問題が1つ存在します。 Yで繰り返す場合は、プログラムでのみ行うことができます。
は、私が(重力の塗りつぶしを設定する)このように私の問題を解決するため
<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/table_cells_bg_img"
android:tileMode="repeat" android:gravity="fill" />
とレイアウト
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="@dimen/table_cell_height">
<ImageView
android:id="@+id/imageView1"
android:layout_width="fill_parent"
android:layout_height="@dimen/table_cell_height"
android:scaleType="fitXY"
android:src="@drawable/table_cells_bg"/>
<TextView
android:id="@+id/txtActivityTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toRightOf="@+id/avatarImage"
android:text="TextView"
android:textColor="@color/white"
android:textSize="@dimen/font_size_middle" />
</RelativeLayout>
そして、それは幅= 1ピクセルと高さを持つ画像ですtable_cells_bg_img上の画像
ため描画可能BG = 1px
などのレイアウトです。したがって、あなたの画像はバックグラウンドですそれは親のレイアウトの任意のサイズのためにリサイズされます
、多分助けてください。私の場合にクリアするには、私はiOS上で行うことができるように、X座標で繰り返されるテーブルセルのフルサイズにタイル張りの背景イメージが必要です。だから私はそれが私のように解決します。
android:scaleTypeこれをImageViewに入れると、 "fitXY"が必要です。 –