2014-09-28 10 views
1

Я хочу разместить стрелку в своем списке.Разместить изображение в центре

Я пытаюсь, но я не делал it.Here мой результат:

enter image description here

Ожидаемый результат:

enter image description here

Это lisview.And это мой исходный код товаров:

<?xml version="1.0" encoding="utf-8"?> 

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
       android:paddingBottom="4dp" 
       android:paddingTop="4dp" 
       android:orientation="horizontal" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content"> 

    <ImageView 
      android:id="@+id/image" 
      android:layout_width="64dp" 
      android:layout_height="64dp" 
      android:src="@drawable/twitter"/> 

    <LinearLayout 
     android:layout_width="0dp" 
     android:layout_height="wrap_content" 
     android:layout_weight="1" 
     android:orientation="vertical" 
     android:paddingLeft="4dp" 
     android:paddingRight="4dp" > 

     <TextView 
      android:id="@+id/tweet" 
      style="@android:style/TextAppearance.Medium" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:textColor="#0A0A14" 
      android:layout_marginLeft="8dp" 
      android:textSize="15sp" 
      android:fontFamily="sans-serif-condensed" 
      /> 

     <TextView 
      android:id="@+id/handle" 
      style="@android:style/TextAppearance.Small" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:text="There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form" 
      android:textColor="#474747" 
      android:layout_marginLeft="8dp" 
      android:textSize="10sp" 
      android:layout_marginTop="4dp"/> 

      <ImageView 
       android:id="@+id/image1" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_gravity="right" 
       android:layout_weight="1" 
       android:src="@drawable/anchor" /> 

    </LinearLayout> 
</LinearLayout> 

Как разместить стрелку в центре? И у меня есть еще один вопрос. Почему стрелка выглядит большой и размытой над изображением?

ответ

0

Стрелка должна находиться во внешнем LinearLayout. Вы кладете его в вертикальном LinearLayout, но должна быть частью горизонтальной LinearLayout

<ImageView 
android:id="@+id/image1" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" 
android:layout_gravity="right|center_vertical" 
android:src="@drawable/anchor" /> 
+0

Теперь это выглядит так: http://goo.gl/mY6YKL –

+0

удалить вес из ImageView (я редактировал ответ) – Blackbelt

+0

Большое вам спасибо, это сработало. У меня есть еще один вопрос, изображение профиля пользователя - 70x70 px в fireworkss.Что должно быть в системе android dp для получения того же результата. –

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