Newbie question I am trying to work out how to wrap text around a button. The button atm has an area down the whole screen..
this is my view - please and thank you
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#3ea155ff"
android:padding="0.1dp"
android:weightSum="1">
<TextView
android:id="@+id/widgetMood"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1.11"
android:gravity="center"
android:shadowColor="@android:color/black"
android:shadowDx="1"
android:shadowDy="2"
android:shadowRadius="3"
android:text="Inspirational messages that update every 30 mins or click the lovemeditation icon for more.. "
android:textColor="@android:color/white">
</TextView>
<ImageButton
android:id="@+id/widgetBtn"
android:layout_width="60dp"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:background="@null"
android:scaleType="fitStart"
android:src="@drawable/ic_launcher">
</ImageButton>
The problem is that you are using a LinearLayout
. In this way each element will take its own portion of space without going to take the place of another.
Try replacing LinearLayout
with a RelativeLayout
for instance and set the positions as you want.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.