2017-08-30 41 views
0

我想作以下XML列表:创建复杂的Android XML组件

original list

的时候,我有这样的:

my component (which will go inside a list)

这里是我的XML分量代码:

list_item_issue.xml

<LinearLayout 
xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:orientation="horizontal" 
android:weightSum="1"> 

<ImageView 
    android:id="@+id/imageView" 
    android:layout_width="38dp" 
    android:layout_height="38dp" 
    android:layout_marginLeft="@dimen/_5dp" 
    android:layout_marginTop="8dp" 
    android:adjustViewBounds="true" 
    android:cropToPadding="false" 
    android:scaleType="fitXY" 
    android:src="@drawable/circle_line_shape" 
    android:tint="@color/colorGray" /> 

<com.daasuu.bl.BubbleLayout 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_marginTop="10dp" 
    android:layout_marginLeft="10dp" 
    android:layout_marginRight="@dimen/_5dp" 
    android:padding="3dp" 
    app:bl_arrowDirection="left" 
    app:bl_arrowHeight="14dp" 
    app:bl_arrowPosition="10dp" 
    app:bl_arrowWidth="8dp" 
    app:bl_cornersRadius="0dp" 
    app:bl_strokeWidth="0.5dp"> 

    <RelativeLayout 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_marginLeft="@dimen/_5dp" 
     android:orientation="horizontal"> 

     <TextView 
      android:id="@+id/parent_list_issue_title_text_view" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_gravity="center_vertical" 
      android:layout_marginRight="3dp" 
      android:text="Titulo de la incidencia" 
      android:textSize="12sp" 
      android:textColor="@android:color/black" /> 

     <TextView 
      android:id="@+id/parent_list_issue_subtitle_text_view" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_below="@+id/parent_list_issue_title_text_view" 
      android:textColor="@color/grey_semi_transparent" 
      android:textSize="10sp" 
      android:text="Subtitulo de la incidencia - Texto de prueba aplicación" /> 

     <ImageButton 
      android:id="@+id/parent_list_item_expand_arrow" 
      android:layout_width="30dp" 
      android:layout_height="25dp" 
      android:src="@drawable/arrow_drop_down_circle" 
      android:paddingRight="5dp" 
      android:layout_centerVertical="true" 
      android:layout_alignParentEnd="true" 
      android:adjustViewBounds="true" 
      android:cropToPadding="false" 
      android:scaleType="fitXY" 
      android:background="@color/white"/> 

    </RelativeLayout> 

</com.daasuu.bl.BubbleLayout> 

这里是我的circle_line_shape.xml

<?xml version="1.0" encoding="utf-8"?> 
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> 
    <item> 
     <bitmap android:src="@drawable/ic_circle" 
       android:gravity="center" /> 
    </item> 
</layer-list> 

问题是,我不知道该怎样做与BubbleLayout对准那些圈+垂直线条状,你可以看到的想法原始列表图像。

¿我应该改变我的布局结构吗?

非常感谢!

回答

0

使用RelativeLayout而不是线性。使图像视图匹配高度。使泡泡layout_toEnd进入图像视图。使relative_layout本身为wrap_content。这将使相对布局成为气泡布局的高度,而图像则是相对布局的高度。

+0

不起作用:(ImageView高度现在是整个屏幕,其他元素保持不变 – Pedro