2016-03-31 5 views
0

У меня есть следующий код для создания элемента чата, но ImageView показывает неуравновешенное отношение к дизайну. Макет показывает, как this, когда я запускаю программу, ¿Как я могу видеть вид с именем «avatar» в нижней части RelativeLayout?Выровняйте RelativeLayout в нижней части андроида.

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" 
android:orientation="vertical" 
android:layout_marginLeft="@dimen/stixchat_margin_8" 
android:layout_marginRight="@dimen/margin_item_chat_right" 
android:layout_marginTop="@dimen/stixchat_margin_8" 
> 

<LinearLayout 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:id="@+id/content_avatar" 
    android:orientation="vertical" 
    > 


    <com.trongphuc.emoappchat.FriendProfileImageViewLast 
     android:id="@+id/avatar" 
     android:layout_width="62dp" 
     android:layout_height="62dp" 
     android:layout_marginLeft="10dp" 

     /> 
</LinearLayout> 



<RelativeLayout 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:background="@drawable/bubble_test" 
    android:id="@+id/content_content" 
    > 

    <TextView 
     android:id="@+id/content" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentTop="true" 
     android:layout_marginLeft="4dp" 
     android:text="New Text" 
     android:lineSpacingMultiplier="@dimen/chat_text_spacing" 
     android:textAppearance="@style/StixChatText.Primary.Light" 
     android:textColor="@android:color/white" /> 

</RelativeLayout> 



<ImageView 
    android:id="@+id/check" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_centerVertical="true" 
    android:layout_alignParentLeft="true" 
    android:src="@drawable/box_checkk" 
    android:padding="@dimen/stixchat_margin_16"/> 

<RelativeLayout 
    android:id="@+id/item_chat_status_root" 
    android:layout_below="@+id/content_content" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_toRightOf="@+id/content_avatar" 
    android:layout_marginLeft="@dimen/stixchat_margin_8" 
    android:visibility="gone"> 

    <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentRight="true" 
     android:textSize="10dp" 
     android:text="24/03/2016 at 20:20" 
     android:id="@+id/item_chat_status_tv" /> 
</RelativeLayout> 
</RelativeLayout> 

ответ

0

RelativeLayout дает вам атрибуты, которые вы можете добавить в свои XML-файлы макета.

В вашем случае, вам нужно будет добавить к вашей линейной компоновки:

андроид: layout_alignParentBottom = «истинный»

Это сделало бы контейнер выравнивать вниз его родителя.

Вы можете просмотреть документацию здесь - http://developer.android.com/guide/topics/ui/layout/relative.html

+0

Вы имеете в виду alignParentBottom? – zgc7009

+0

Да, вы правы. внесли изменения –

Смежные вопросы