-1
Hello, I’m a beginner in Android Studio, and I had a problem with alignment, I already took a look at similar questions but could not solve the problem. My layout is like this:
I need to leave Altitude, Latitude and Longitude to the left and the numbers, latitudeTest and longitudeTest to the right, more or less like this:
Altitude: 10.0
Latitude: latitudeTest
Longitude: longitudeTest
My code is like this
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/item_horizontal_margin"
android:layout_marginEnd="@dimen/item_horizontal_margin"
android:orientation="vertical">
<TextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
<!--Altitude:-->
android:text="@string/lb_altitude" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
<!--10.0:-->
android:text="@={``+waypoint.altitude}" />
<TextView
android:id="@+id/lb_latitude"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
<!--Latitude:-->
android:text="@string/lb_latitude" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/lb_latitude"
android:text="latitudeTest" />
<TextView
android:id="@+id/lb_longitude"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
<!--Longitude:-->
android:text="@string/lb_longitude" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/lb_longitude"
android:text="longitudeTeste" />
</LinearLayout>
I appreciate suggestions and help! Thank you
There are many ways to do this... You can use each line within one
LinearLayout
with horizontal orientation, you can useRelativeLayout
, I guess you can do withConstraintLayout
also... have you tried to do any of these things?– Rafael Tavares