M
M
max41122017-08-03 14:50:29
css
max4112, 2017-08-03 14:50:29

How to assign a layout'a background?

Good afternoon. The problem is this: there is a layout. It needs to adjust to the size of the content. Parameters width\height cost wrap_content. But here's the problem: when I put a background on it, the layout itself stretches to the maximum width. How can this be fixed? code and screenshot below

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:background="@drawable/oblakol"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_centerInParent="true"
    >
    <TextView
        android:id="@+id/textView8"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="TextView" />
</FrameLayout>

1e325c7e64694de1be334d13167a15f2.png

Answer the question

In order to leave comments, you need to log in

4 answer(s)
R
Rustam Bainazarov, 2019-03-12
@denvis

P
prrrrrrr, 2019-03-12
@prrrrrrr

and why did they give the order for freelancing then ??

Y
Yuri, 2017-08-03
@YuryBorodkin

need 9-patch image.
how to do here

K
K0DiBEN, 2017-08-03
@K0DiBEN

android:background="@drawable/oblakol"
Try removing the background parameter from the parent's Layout and pasting it into the TextView)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question