Reputation: 656
all. this is my layout code:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:background="@mipmap/backgroung"
tools:context=".MainScreen">
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30pt"
android:text="@string/level1"
android:onClick="@string/level1"
android:id="@+id/level1"/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="60pt"
android:text="@string/level2"
android:id="@+id/level2"/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="90pt"
android:text="@string/level3"
android:id="@+id/level3"/>
It look like is:
I want that the punch photo will stretch all over the white background.
Thanks for helpers!
Upvotes: 1
Views: 333
Reputation: 656
I got it, when add new image asset it resize the image and crop to with white borders. Need to hard copy-paste the entire photo to the drawable folder.
Upvotes: 1
Reputation: 6646
In your RelativeLayout, do you see those android:paddingTop
and bottom/left/right? Remove all those or change to ="0dp"
.
Move your image into <ImageView/>
before the buttons.
And use android:scaleType="fitXY"
Oh, make sure your pic does not have any whitespace border.
Upvotes: 0
Reputation: 1096
Better to use a 9patch image here. In which the punch area can be constant and the image can stretch with the blue region. That way you won't face the issue of the image being blurred because of stretching. You can find some good examples of how to create a 9patch from youtube. here's a sample.
Upvotes: 1