/ /背景画像を移動することは可能ですか? - アンドロイド、イメージ、背景イメージ

背景画像を移動することは可能ですか? - アンドロイド、イメージ、背景イメージ

以下のコードを使って背景画像を設定しました

<AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:background="@mipmap/background_image"
android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity">

背景画像のあるマイページ

ここに画像の説明を入力

背景画像のサイズを調整する方法があり、画像を左側に移動できますか?

回答:

回答№1は0

背景画像を調整したい場合は、FrameLayoutまたはRelativeLayoutのFirst ChildとしてImageViewを使用し、残りのコントロールをSecond Childまたは残りの子での要件に従って整理する必要があります。


回答№2の場合は1

あなたは、 BitmapDrawable 背景の位置を調整します。 しかし、正しいサイズのミップマップを取得する必要があります。 back.xml

<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android" android:src="@drawable/ic_launcher" android:gravity="left|top">
</bitmap>


android:background="@drawable/back"