Why are some of my views not matching correctly at the bottom of my relative layout?

I have problems aligning some of my views in the relative layout that I use in my list box.

Here is a screenshot from the layout linker in Eclipse, I think it should look like this:

alt text
(source: janusz.de )

The following image is from an emulator. Now TestTestTest View is at the top and covers the name and distance of Textviews.

alt text
(source: janusz.de )

This is my layout:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:padding="4dip">

<ImageView android:id="@+id/logo" android:layout_width="wrap_content"
    android:layout_height="wrap_content" android:adjustViewBounds="true"
    android:scaleType="centerInside" android:src="@drawable/icon"
    android:layout_centerVertical="true" android:layout_alignParentLeft="true"
    android:background="@color/green" />

<TextView android:id="@+id/distance" android:layout_width="wrap_content"
    android:layout_height="wrap_content" android:text="Distance"
    android:layout_alignParentRight="true" android:layout_alignParentTop="true"
    android:paddingRight="4dip" android:background="#000000" />

<TextView android:id="@+id/name" android:layout_width="fill_parent"
    style="@style/ListHeadText" android:layout_height="wrap_content"
    android:text="Name"
    android:layout_alignTop="@id/distance" android:layout_toRightOf="@id/logo"
    android:layout_toLeftOf="@id/distance" android:gravity="clip_horizontal"
    android:lines="1" android:paddingLeft="4dip" android:background="@color/red" />

<TextView android:id="@+id/number" android:layout_width="wrap_content"
    android:layout_height="wrap_content" android:text="Number"
    android:paddingRight="4dip" android:layout_alignRight="@id/distance"
    android:background="@color/darkred" android:layout_below="@id/distance" />

<TextView android:id="@+id/subcategory" android:layout_width="wrap_content"
    android:layout_height="wrap_content" android:text="Subcategory"
    android:paddingLeft="4dip" android:layout_alignLeft="@id/name"
    android:lines="1" android:gravity="clip_horizontal"
    android:layout_below="@id/distance" android:background="@color/green" />

<TextView android:id="@+id/test" android:layout_width="fill_parent"
    android:layout_height="wrap_content" android:text="TestTestTest"
    android:paddingLeft="4dip" 
    android:layout_alignParentBottom="true" android:gravity="bottom"
    android:background="@color/red" />

Shouldn't align_parent_bottom put the view at the bottom of the cell in the list?

0
source share
1 answer

android:layout_alignParentLeft="true"; , 2 . , RelativeLayout ListView? , , , . , - , RelativeLayout , ListView. , , LinearLayouts.

+1

Source: https://habr.com/ru/post/1739238/


All Articles