D
D
dimasik1002002018-08-21 17:32:34
Java
dimasik100200, 2018-08-21 17:32:34

Why is it not aligned exactly to the right?

We want the contents of the large liner layout (where the textview and the other linerlayout) are aligned equally to the right. How to do it? Tried with android:gravity="end", but the child linerlayout still recedes to the left.
5b7c225e43f36170870359.jpeg

Here is the complete xml code
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:gravity="end">

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:gravity="end"
        android:padding="8dp"
        android:orientation="vertical">

        <TextView
            android:id="@+id/item_message_text"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:autoLink="web"
            tools:text="Message"
            android:textColor="?android:textColorPrimary"
            android:textSize="@dimen/font_size_subtitle"/>

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="horizontal">

            <TextView
                android:id="@+id/item_message_view_text"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="views"
                android:layout_marginEnd="10dp"
                android:textColor="?android:textColorSecondary"
                android:textSize="@dimen/font_size_additional" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="time"
                android:textSize="@dimen/font_size_additional"/>


        </LinearLayout>

    </LinearLayout>
    
</RelativeLayout>

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Mikhail Chvarkov, 2018-08-22
@KuSu

In fact, you have them aligned correctly, something is wrong with the display in the studio.

V
Vadim Popov, 2018-08-22
@vadimpopov94

try to remove dimasik100200 from markup
android:layout_marginEnd="10dp"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question