How to draw lines between two image layout

I am trying to create layout which has four buttons.

I have managed to show the four image buttons but I couldn't show separating lines. In the following image you can see what I am trying to design:

Answers


Use a relative layout and add View objects first to separate them (see below). You'll have to add whatever other parameters you want...

<RelativeLayout
    android:layout_width          = "match_parent"
    android:layout_height         = "match_parent">

    <View
        android:id                      = "@+id/vertical_divider"
        android:layout_centerHorizontal = "true"
        android:layout_width            = "1dip"
        android:layout_height           = "match_parent">
    </View>

    <View
        android:id                      = "@+id/horizontal_divider"
        android:layout_centerVertical   = "true"
        android:layout_width            = "match_parent"
        android:layout_height           = "1dip">
    </View>

    <ImageButton
        android:layout_alignParentTop   = "true"
        android:layout_alignParentLeft  = "true"
        android:layout_toLeftOf         = "@id/vertical_divider"
        android:layout_above            = "@id/horizontal_divider"
        android:layout_width            = "match_parent"
        android:layout_height           = "match_parent">
    </ImageButton>

    <ImageButton
        android:layout_alignParentTop   = "true"
        android:layout_alignParentRight = "true"
        android:layout_toRightOf        = "@id/vertical_divider"
        android:layout_above            = "@id/horizontal_divider"
        android:layout_width            = "match_parent"
        android:layout_height           = "match_parent">
    </ImageButton>

    <ImageButton
        android:layout_alignParentBottom = "true"
        android:layout_alignParentLeft   = "true"
        android:layout_toLeftOf          = "@id/vertical_divider"
        android:layout_below             = "@id/horizontal_divider"
        android:layout_width             = "match_parent"
        android:layout_height            = "match_parent">
    </ImageButton>

    <ImageButton
        android:layout_alignParentBottom = "true"
        android:layout_alignParentRight  = "true"
        android:layout_toRightOf         = "@id/vertical_divider"
        android:layout_below             = "@id/horizontal_divider"
        android:layout_width             = "match_parent"
        android:layout_height            = "match_parent">
    </ImageButton>
</RelativeLayout>

Add layout_marginBottom="1dip" and layout_marginRight="1dip" in your Imageviews.


Need Your Help

Display web page using libgtkhtml c c++

c++ html c gtk

I want to display a very simple html page from the web, using libgtkhtml. Can you give an example please? Or some documentation/resources? I found nothing. (C preferred, but C++ also acceptable). T...

Core data storage is repeated

iphone

I am trying to use Core Data in my application and I have been succesful in storing data into the entity.The data storage is done in the applicationDidFinishLaunchingWithOptions() method.But when I...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.