2016-08-11 3 views
0

Делаю дизайн как следующий снимок экрана, но я не могу получить точно так же, как показано на снимке экрана.Граница списка просмотров каждой строки в android

enter image description here

Вот мой список вид

<ListView 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_marginTop="60dp" 
    android:id="@+id/list" 
    android:divider="@drawable/redemption_request_list_border" 
    android:dividerHeight="5px" 
    /> 

Все это элемент я отображение в виде списка

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:paddingLeft="15dp" 
    android:paddingRight="15dp" 
    > 

       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:id="@+id/lblRedemptionDate" 
        android:text="Redemption Date" 
        android:textSize="20sp" 
        android:textColor="@color/text_color_white" 
        /> 
       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:id="@+id/lblTrackingId" 
        android:text="Tracking ID" 
        android:textSize="20sp" 
        android:textColor="@color/text_color_white" 
        android:layout_alignParentRight="true" 
        /> 

       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="Loyalty ID :" 
        android:textSize="20sp" 
        android:id="@+id/lblLoyaltyId" 
        android:layout_below="@+id/lblRedemptionDate" 
        android:textColor="@color/text_color_white" 
        /> 
       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:id="@+id/txtLoyaltyId" 
        android:text="Loyalty ID" 
        android:textSize="20sp" 
        android:layout_below="@+id/lblTrackingId" 
        android:layout_alignParentRight="true" 
        android:textColor="@color/text_color_white" 
        /> 

       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="Status :" 
        android:id="@+id/lblRedemptionStatus" 
        android:textSize="20sp" 
        android:layout_below="@+id/lblLoyaltyId" 
        android:textColor="@color/text_color_white" 
        /> 
       <Spinner 
        android:layout_width="190dp" 
        android:layout_height="35dp" 
        style="@style/spinner_style" 
        android:textSize="@dimen/small_button_font_size" 
        android:id="@+id/spnRdmStatus" 
        android:layout_below="@+id/txtLoyaltyId" 
        android:layout_toLeftOf="@+id/imgStatusEdit" 
        android:layout_toRightOf="@+id/lblRedemptionStatus" 
        android:spinnerMode="dropdown" 
        android:visibility="gone" 
        /> 
       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:textSize="20sp" 
        android:id="@+id/txtRdmStatus" 
        android:layout_below="@+id/txtLoyaltyId" 
        android:layout_toLeftOf="@+id/imgStatusEdit" 
        android:layout_toRightOf="@+id/lblRedemptionStatus" 
        android:textColor="@color/text_color_white" 
        android:visibility="visible" 
        /> 
       <ImageView 
        android:layout_width="35dp" 
        android:layout_height="35dp" 
        android:layout_centerVertical="true" 
        android:layout_alignParentRight="true" 
        android:src="@drawable/ic_charge_card_edit_view" 
        android:id="@+id/imgStatusEdit" 
        android:layout_below="@+id/txtLoyaltyId" 
        /> 
       <ImageView 
        android:layout_width="35dp" 
        android:layout_height="35dp" 
        android:layout_centerVertical="true" 
        android:layout_alignParentRight="true" 
        android:src="@drawable/ic_status_success" 
        android:id="@+id/imgStatusSave" 
        android:layout_below="@+id/txtLoyaltyId" 
        android:visibility="gone" 
        /> 
       <Button 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_marginTop="20dp" 
        android:id="@+id/btnViewItems" 
        android:text="View Items" 
        android:textAllCaps="true" 
        android:textSize="20sp" 
        android:layout_below="@+id/lblRedemptionStatus"/> 



</RelativeLayout> 

Вот моя граница списке, но границы не показывая.

<?xml version="1.0" encoding="utf-8"?> 
<shape xmlns:android="http://schemas.android.com/apk/res/android" 
    android:shape="rectangle" > 

    <solid android:color="#FFF" /> 

    <stroke android:width="1dip" 
     android:color="#FFFFFF" /> 
</shape> 

и я получаю эту конструкцию

enter image description here

Любой может помочь в этом, спасибо!

+0

использования cardview с recyclerview InstEd из ListView вы получите точное расположение, как вы хотите – siddhesh

+0

но карты мнения я могу заполнить Список_массивы значения как в виде списка – Raju

+0

вы нужно использовать recyclerview вместо listview и использовать cardview для каждой строки, используя эту ссылку http://www.androidhive.info/2016/05/android-working-with-card-view-and-recycler-view/ – siddhesh

ответ

0

Применить cardview в макете представления элементов, как этот

<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:elevation="2dp" 
    android:padding="5dp" 
    app:cardCornerRadius="5dp"> 

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

    <TextView 
     android:id="@+id/lblRedemptionDate" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="Redemption Date" 
     android:textColor="@color/text_color_white" 
     android:textSize="20sp" /> 

    <TextView 
     android:id="@+id/lblTrackingId" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentRight="true" 
     android:text="Tracking ID" 
     android:textColor="@color/text_color_white" 
     android:textSize="20sp" /> 

    <TextView 
     android:id="@+id/lblLoyaltyId" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_below="@+id/lblRedemptionDate" 
     android:text="Loyalty ID :" 
     android:textColor="@color/text_color_white" 
     android:textSize="20sp" /> 

    <TextView 
     android:id="@+id/txtLoyaltyId" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentRight="true" 
     android:layout_below="@+id/lblTrackingId" 
     android:text="Loyalty ID" 
     android:textColor="@color/text_color_white" 
     android:textSize="20sp" /> 

    <TextView 
     android:id="@+id/lblRedemptionStatus" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_below="@+id/lblLoyaltyId" 
     android:text="Status :" 
     android:textColor="@color/text_color_white" 
     android:textSize="20sp" /> 

    <Spinner 
     android:id="@+id/spnRdmStatus" 
     style="@style/spinner_style" 
     android:layout_width="190dp" 
     android:layout_height="35dp" 
     android:layout_below="@+id/txtLoyaltyId" 
     android:layout_toLeftOf="@+id/imgStatusEdit" 
     android:layout_toRightOf="@+id/lblRedemptionStatus" 
     android:spinnerMode="dropdown" 
     android:textSize="@dimen/small_button_font_size" 
     android:visibility="gone" /> 

    <TextView 
     android:id="@+id/txtRdmStatus" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_below="@+id/txtLoyaltyId" 
     android:layout_toLeftOf="@+id/imgStatusEdit" 
     android:layout_toRightOf="@+id/lblRedemptionStatus" 
     android:textColor="@color/text_color_white" 
     android:textSize="20sp" 
     android:visibility="visible" /> 

    <ImageView 
     android:id="@+id/imgStatusEdit" 
     android:layout_width="35dp" 
     android:layout_height="35dp" 
     android:layout_alignParentRight="true" 
     android:layout_below="@+id/txtLoyaltyId" 
     android:layout_centerVertical="true" 
     android:src="@drawable/ic_charge_card_edit_view" /> 

    <ImageView 
     android:id="@+id/imgStatusSave" 
     android:layout_width="35dp" 
     android:layout_height="35dp" 
     android:layout_alignParentRight="true" 
     android:layout_below="@+id/txtLoyaltyId" 
     android:layout_centerVertical="true" 
     android:src="@drawable/ic_status_success" 
     android:visibility="gone" /> 

    <Button 
     android:id="@+id/btnViewItems" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_below="@+id/lblRedemptionStatus" 
     android:layout_marginTop="20dp" 
     android:text="View Items" 
     android:textAllCaps="true" 
     android:textSize="20sp" /> 
</android.support.v7.widget.CardView> 
Смежные вопросы