2016-12-21 9 views
0

я хочу сделал ListView, который больше похож на этоУстановите Drawable формы на каждой позиции должным образом с полями

enter image description here

Я предполагаю, что нужно использовать макет кадра в каждом пункте и установить поля, чтобы соответствовать левому форма половина за пределами одного пункта, но я не знаю, как настроить его правильно

у меня уже есть рисуем форму, мне нужно только установить его как на picuture

редактировать: Может быть, мне нужно поместить рисуем форму В моем custo м rounded_item_that выглядит, что

<shape xmlns:android="http://schemas.android.com/apk/res/android" > 
    <stroke 
     android:width="1dp" 
     android:color="@color/gray" /> 

    <solid android:color="@color/white" /> 

    <padding 
     android:left="5dp" 
     android:right="5dp" 
     android:top="5dp" 
     android:bottom="10dp"/> 

    <corners android:radius="5dp" /> 
    </shape> 
+0

использование 'gradientDrawable' – rookieDeveloper

ответ

1

Это может помочь вам

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" 
android:layout_height="wrap_content"> 

    <LinearLayout 
     android:id="@+id/layout1" 
     android:layout_width="200dp" 
     android:layout_height="100dp" 
     android:background="#f1c21e" 
     android:layout_centerHorizontal="true" 
     android:orientation="horizontal" /> 

    <LinearLayout 
     android:layout_width="50dp" 
     android:layout_height="50dp" 
     android:background="#000000" 
     android:layout_alignStart="@+id/layout1" 
     android:layout_alignLeft="@+id/layout1" 
     android:layout_centerVertical="true" 
     android:layout_marginLeft="-25dp"/> 

     <!--set margin to half the width of the layout--> 

</RelativeLayout> 

enter image description here

+0

спасибо, что решение HelpMe вне! – Expiredmind

+0

Рад .. это помогло у !!! –

0

Попробуйте это. Он работает ..

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

<android.support.v4.widget.NestedScrollView 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior"> 

    <android.support.v7.widget.CardView 
     android:id="@+id/cv" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_margin="40dp"> 

     <TextView 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:padding="50dp" 
      android:textSize="20sp" 
      android:textStyle="bold" 
      android:text="Item 1" /> 

    </android.support.v7.widget.CardView> 

</android.support.v4.widget.NestedScrollView> 

<ImageView 
    android:layout_height="wrap_content" 
    android:layout_width="wrap_content" 
    android:src="@drawable/fingerprint" 
    app:layout_anchor="@id/cv" 
    app:layout_anchorGravity="left|center" 
    android:layout_margin="16dp" 
    android:clickable="true"/> 

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

  • Нет связанных вопросов^_^