mardi 19 mai 2015

Cannot align Imageview below another Imageview

This is what I am require to do(The menu):

enter image description here

and this is what I have achieved so far:

enter image description here

Please see the horizontal line below an image within the list.I cannot make my screen-shot similar to the requirement.

Code:

popupmenurow.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://ift.tt/nIICcg"
    android:id="@+id/ll_menu_row_cont"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#ffffff"
    android:orientation="horizontal" >

    <RelativeLayout
        android:id="@+id/rl_image"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content">

    <ImageView
        android:id="@+id/imgmenuicon"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"//this is the image icon
        android:layout_margin="10dp"
        android:contentDescription="@null" />

    <ImageView//this is the horizontal line
        android:contentDescription="@null"
        android:id="@+id/horizontalline"
        android:layout_width="wrap_content"
        android:layout_height="1dp"
        android:layout_below="@+id/imgmenuicon"
        android:layout_alignLeft="@+id/imgmenuicon"
        android:layout_alignRight="@+id/imgmenuicon"
        android:background="#4d4b56" />

    </RelativeLayout>

    <ImageView
        android:contentDescription="@null"
        android:id="@+id/verticalline"
        android:layout_width="1dp"
        android:layout_height="fill_parent"
        android:layout_marginLeft="15dp"
        android:background="#4d4b56" />

    <TextView
        android:id="@+id/tvmenutitle"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="10dp"
        android:paddingBottom="10dp"
        android:paddingLeft="5dp"
        android:paddingTop="10dp"
        android:text="Hello"
        android:textColor="@color/menutextcolor"
        android:textSize="16sp" />

</LinearLayout>

and here is the list popup_layout.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://ift.tt/nIICcg"
    android:id="@+id/popup"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="#ffffff"
    android:orientation="vertical" >

    <ListView
        android:id="@+id/list_slide"
        android:layout_width="match_parent"
        android:layout_height="fill_parent"
        android:background="#ffffff"
        android:choiceMode="singleChoice"
        android:divider="@null"
        />

</LinearLayout>

What shall I do to make the horizontal line below the imageview,similar to that of my requirement(The image on the top)?

If I remove

 android:layout_alignLeft="@+id/imgmenuicon"
        android:layout_alignRight="@+id/imgmenuicon" 

then the line is not showing up.Also I understand that the margins occuring to the left and right of the horizontal line is due to android:layout_margin="10dp" within the imageview.But I cannot find a solution.

Aucun commentaire:

Enregistrer un commentaire