Horizontal rule: how to? - java

i would like to know how to insert an horizontal rule between the first textview and the second. The code is this. I searched on google and found various codes but they do not work for me
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/RelativeLayout2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:id="#+id/textView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="20dp"
android:textColor="#color/red"
android:textStyle="bold"
android:text="#string/desc"
/>
<TextView
android:id="#+id/textView2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="60dp"
android:textStyle="bold|italic"
android:text="Welcome"
android:textAppearance="?android:attr/textAppearanceLarge"
/>
</RelativeLayout>

Between the two TextViews, add a simple View, give it the background you want (a color or an image) and make it as high as you need the rule to be:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView android:id="#+id/text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Testing"
android:layout_alignParentTop="true"/>
<View android:id="#+id/divider"
android:layout_width="fill_parent"
android:layout_height="2dp"
android:background="#android:color/white"
android:layout_below="#id/text"
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Testing"
android:layout_below="#id/divider"/>
</RelativeLayout>

Like the other guy said just add a view between them..so now your code should like this
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/RelativeLayout2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:id="#+id/textView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="20dp"
android:textColor="#color/red"
android:textStyle="bold"
android:text="#string/desc"
/>
<View
android:background="#266E10"
android:layout_height="2dp"
android:layout_width="match_parent"/>
<TextView
android:id="#+id/textView2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="60dp"
android:textStyle="bold|italic"
android:text="Welcome"
android:textAppearance="?android:attr/textAppearanceLarge"
/>
</RelativeLayout>

Related

setting up a tablelayout

I am trying to build a list application for now and I need to align both the button and the text in the same row but as I am extremely new to android studio and Java I am having trouble. any guides I have found are out of date
my code is below
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:weightSum="1"
android:strechColumns="1">
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"
android:baselineAligned="false">
<TextView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="Job 1"
/>
</TableRow>
<ToggleButton
android:id="#+id/button1"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:onClick=""
android:text="test text"
/>
</TableLayout>
any help would be much appreciated
Try below code inside tag:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="Job 1"
/>
<ToggleButton
android:id="#+id/button1"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:onClick=""
android:text="test text"
/>
/>
Putting your ToggleButton in TableRow will put your items in same row.
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:weightSum="1"
android:strechColumns="1">
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"
android:baselineAligned="false">
<TextView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="Job 1"/>
<ToggleButton
android:id="#+id/button1"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:text="test text"/>
</TableRow>
</TableLayout>
Other then that If you can achieve same with using List/RecyclerView Adapter if you only need two elements in row,
Using List/RecyclerView is simple approach then TableView. In your Adapter use following XML code for item iterations
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toLeftOf="#+id/toggleButton"
android:layout_toStartOf="#+id/toggleButton"
android:layout_alignParentleft="true"
android:layout_alignParentStart="true"
android:text="test "/>
<ToggleButton
android:id="#+id/toggleButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"/>
</RelativeLayout>

Android layout inconsistency

I have a layout that is being displayed in two different layouts. First one is being displayed in a LinearLayout and it behaves as expected:
However, when this layout is part of a listview, the textview is not centered:
Here's the layout:
<?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="130dp"
android:orientation="vertical">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="100dp"
android:orientation="horizontal"
android:padding="5dp">
<com.parse.ParseImageView
android:id="#+id/iv"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:scaleType="fitCenter"/>
<TextView
android:id="#+id/tv_title"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2.5"
android:layout_marginLeft="10dp"
android:textAppearance="#android:style/TextAppearance.Holo.Medium"
android:ellipsize="end"
android:maxLines="3"
android:textStyle="bold"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="25dp"
android:orientation="horizontal"
android:paddingLeft="10dp">
<View
android:layout_width="20dp"
android:layout_height="20dp"
android:background="#color/blue"
android:layout_gravity="center"
/>
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#color/gray"
android:layout_margin="7dp"
/>
<TextView
android:id="#+id/tv_source"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textAppearance="#android:style/TextAppearance.Holo.Small"
android:gravity="center"/>
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#color/gray"
android:layout_margin="7dp"
/>
<TextView
android:id="#+id/tv_date"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:fontFamily="sans-serif-light"
android:textAppearance="#android:style/TextAppearance.Small"
android:gravity="center"/>
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#color/gray"
android:layout_margin="7dp"
/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/ic_fire"
android:layout_gravity="center"/>
<TextView
android:id="#+id/tv_viewCount"
android:layout_marginLeft="5dp"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:fontFamily="sans-serif-light"
android:textAppearance="#android:style/TextAppearance.Small"
android:gravity="center"/>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="5dp"/>
</LinearLayout>
<ImageView
android:id="#+id/pin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/ic_pin"/>
<TextView
android:id="#+id/comment_tv"
android:layout_width="0dp"
android:layout_height="0dp"
android:textColor="#color/white"
android:layout_alignTop="#+id/pin"
android:layout_alignBottom="#+id/pin"
android:layout_alignLeft="#id/pin"
android:layout_alignRight="#+id/pin"
android:gravity="center"
android:layout_marginBottom="10dp"/>
</RelativeLayout>
The textView that I am referring to is at the bottom with id comment_tv
What am I doing wrong?
Thanks
Your pin+text inside a relative layout:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="60dp"
android:layout_gravity="center_vertical" >
<ImageView
android:id="#+id/pin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/ic_pin"/>
<TextView
android:id="#+id/comment_tv"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_alignTop="#id/pin"
android:gravity="center"
android:layout_marginTop="10dp" //set this higher if you need
android:layout_centerHorizontal="true" //if this text will be not in the center
//you can use the "layout_marginLeft" to put whatever you want
/>
</RelativeLayout>
This should but the text on the spot you want
I tried it with your image and this is my result with underlying code. Is this what you are looking for?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/sample"
android:gravity="center"
android:text="12"
android:textSize="18sp" />
</LinearLayout>
And heres a snapshot of this code:

Custom ListView text always overlays each other

I have made a card layout for displaying a list of data. For some reason, no matter which properties I change for layout width, height, weight, etc, the text is always shown on top of other lines of text, as shown below.
What am I missing?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:orientation="horizontal"
android:background="#drawable/card_inset">
<RelativeLayout
android:id="#+id/eventDetails"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="70"
android:orientation="vertical" >
<TextView
android:id="#+id/eventTeams"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:textSize="17sp" />
<TextView
android:id="#+id/eventClickForMore"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:textSize="14sp" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/eventTimeSection"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="30"
android:orientation="vertical" >
<TextView
android:id="#+id/eventTime"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center"
android:textSize="22sp" />
<TextView
android:id="#+id/eventDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:gravity="center"
android:textAlignment="center"
android:textSize="12sp" />
</RelativeLayout>
In your TextView called eventClickForMore, add the attribute android:layout_below="#+id/eventTeams".
And do the same thing for the TextView called eventDate which should be below eventTime
EDIT
I have updated the code, basically, you need to change the layout_height attribute of eventTeams and eventTimeSection to android:layout_height="wrap_content". match_parent made the TextView to take all the space vertically.
Also I think you could get rid of android:layout_alignParentBottom and android:layout_alignParentLeft in eventClickForMore and eventDate (not sure though, maybe the first update will be enough).
See my code below :
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:orientation="horizontal"
android:background="#drawable/card_inset">
<RelativeLayout
android:id="#+id/eventDetails"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="70"
android:orientation="vertical" >
<TextView
android:id="#+id/eventTeams"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="17sp" />
<TextView
android:id="#+id/eventClickForMore"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#id/eventTeams"
android:textSize="14sp" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/eventTimeSection"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="30"
android:orientation="vertical" >
<TextView
android:id="#+id/eventTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="22sp" />
<TextView
android:id="#+id/eventDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/eventTime"
android:gravity="center"
android:textAlignment="center"
android:textSize="12sp" />
</RelativeLayout>
You can use android:layout_below in your TextView with id #+id/eventClickForMore,
see
<TextView
android:id="#+id/eventClickForMore"
android:layout_width="fill_parent"
android:layout_below = "#id/eventTeams"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:textSize="14sp" />

Center a TextView: Why it doesn't work?

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/RelativeLayout2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:id="#+id/textView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="20dp"
android:textColor="#color/red"
android:textStyle="bold"
android:text="#string/desc"
/>
<TextView
android:id="#+id/textView2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="60dp"
android:textStyle="bold|italic"
android:text="Welcome"
android:textAppearance="?android:attr/textAppearanceLarge"
/>
</RelativeLayout>
I would like to center the second TextView but I can not ... This is the code, you know help me? Where is the error? I'm going crazy!
Add the following to your textview:
android:gravity="center"
But at the same time I would recommend to reconsider your layout as you're having 2 textviews taking the full screen.
Edit
center centers both on horizontal and vertical. If you need only on a specific axis, use one of:
android:gravity="center_horizontal"
or
android:gravity="center_vertical"
try this :
<TextView
android:id="#+id/textView2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="60dp"
android:textStyle="bold|italic"
android:text="Welcome"
android:gravity="center"
android:textAppearance="?android:attr/textAppearanceLarge"
/>
What about setting it this way
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/RelativeLayout2"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<TextView
android:id="#+id/textView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentTop="true"
android:gravity="center"
android:layout_centerHorizontal="true"
android:layout_marginTop="20dp"
android:textColor="#color/red"
android:textStyle="bold"
android:text="#string/desc" />
<TextView
android:id="#+id/textView2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentTop="true"
android:gravity="center"
android:layout_centerHorizontal="true"
android:layout_marginTop="60dp"
android:textStyle="bold|italic"
android:text="Welcome"
android:textAppearance="?android:attr/textAppearanceLarge" />
</RelativeLayout>
Alternatively
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/RelativeLayout2"
android:layout_width="fill_parent"
android:gravity="center"
android:layout_height="fill_parent">
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_contet"
android:layout_height="fill_parent"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="20dp"
android:textColor="#color/red"
android:textStyle="bold"
android:text="#string/desc" />
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="60dp"
android:textStyle="bold|italic"
android:text="Welcome"
android:textAppearance="?android:attr/textAppearanceLarge" />
</RelativeLayout>
Change your layout like this
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/RelativeLayout2"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<TextView
android:id="#+id/textView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="20dp"
android:textColor="#color/red"
android:textStyle="bold"
android:text="#string/desc"
/>
<TextView
android:id="#+id/textView2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_marginTop="60dp"
android:textStyle="bold|italic"
android:text="Welcome"
android:textAppearance="?android:attr/textAppearanceLarge"
/>
</RelativeLayout>
Always use match_parent instead of fill_parent
// try this
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/RelativeLayout2"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_marginTop="60dp"
android:textStyle="bold|italic"
android:text="Welcome"
android:textAppearance="?android:attr/textAppearanceLarge"/>
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_above="#id/textView2"
android:layout_marginTop="20dp"
android:textColor="#color/red"
android:text="#string/desc"
android:textStyle="bold"/>
</RelativeLayout>

How can I make my ListView row look like the Twitter app [Screenshot]?

I am building a Twitter type client. Here is what my ListView row looks like
I want it to look more like:
How can I get my padding and positioning of the avatar correct? Here is my XML:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout android:id="#+id/RelativeLayout01" xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:id="#+id/avatarImageView">
</ImageView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/usernameTextView"
android:textStyle="bold"
android:layout_toRightOf="#+id/avatarImageView"
android:layout_alignParentTop="true" android:textColor="#636363">
</TextView>
<TextView
android:id="#+id/bodyTextView"
android:layout_below="#+id/usernameTextView"
android:layout_toRightOf="#+id/avatarImageView"
android:layout_width="fill_parent"
android:layout_height="wrap_content" android:textColor="#636363">
</TextView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="#+id/usernameTextView"
android:id="#+id/dateTextView"
android:text="date" android:textColor="#636363">
</TextView>
</RelativeLayout>
<ListView android:id="#android:id/list"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:layout_weight="1.0"
android:textColor="#444444"
android:divider="#drawable/list_divider"
android:dividerHeight="1px"
android:cacheColorHint="#00000000">
</ListView>
create your own divider gradient named “list_divider” which is an xml file that you throw in your drawable folder. you just specify the colors for the left, center and right side:
list_divider.xml
<?xml version="1.0" encoding="utf-8"?>
<layer-list
xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<gradient
android:startColor="#999999"
android:centerColor="#555555"
android:endColor="#999999"
android:height="1px"
android:angle="0" />
</shape>
</item>
</layer-list>
layout for each row in the list. This is also done through a layout xml file that you specify later in your code.
row.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:padding="4px">
<ImageView android:id="#+id/avatar"
android:layout_width="48px"
android:layout_height="48px"/>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingLeft="4px">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_weight="1"
android:gravity="center_vertical">
<TextView android:id="#+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="left"
android:textStyle="bold"
android:singleLine="true"
android:ellipsize="end"
android:textColor="#444444"
android:padding="0px"/>
<TextView android:id="#+id/email_url"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="left"
android:singleLine="true"
android:ellipsize="end"
android:padding="0px"
android:textSize="10px"/>
<TextView android:id="#+id/postTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="left"
android:singleLine="true"
android:ellipsize="end"
android:padding="0px"
android:textSize="10px"/>
<TextView android:id="#+id/comment"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="false"
android:textColor="#666666"
android:maxLines="5"
android:ellipsize="end"/>
<TextView android:id="#+id/status"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
edit: removed line number, because i m a kind person
Heere ya go: you just use linear layout instead of relative. and use its weights. and the last important thing is to wrap views inside layout components. like ImageView inside another linearlayout or relative etc.. so try some combinations with this and it will work fine. also for the list divider you can set a null drawable or a custom shape etc. your row background can also be a shape or some color or drawable.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:id="#+id/LinearLayout01" xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="130dp">
<LinearLayout android:layout_height="fill_parent" android:id="#+id/linearLayout1" android:layout_width="wrap_content"
android:orientation="vertical">
<ImageView android:id="#+id/avatarImageView" android:layout_height="75dp" android:layout_width="75dp"></ImageView>
</LinearLayout>
<LinearLayout android:layout_height="fill_parent" android:id="#+id/linearLayout2" android:orientation="vertical"
android:layout_width="fill_parent">
<LinearLayout android:id="#+id/linearLayout3" android:layout_width="fill_parent" android:layout_height="wrap_content">
<TextView android:text="TextView" android:textStyle="bold" android:layout_height="wrap_content"
android:textColor="#636363" android:id="#+id/usernameTextView" android:layout_weight="1" android:layout_width="fill_parent"></TextView>
<TextView android:text="date" android:layout_height="wrap_content" android:textColor="#636363"
android:id="#+id/dateTextView" android:layout_width="wrap_content"></TextView>
</LinearLayout>
<LinearLayout android:layout_height="fill_parent" android:id="#+id/linearLayout4" android:layout_width="fill_parent">
<TextView android:text="TextView" android:layout_height="wrap_content" android:textColor="#636363"
android:id="#+id/bodyTextView" android:layout_width="fill_parent"></TextView>
</LinearLayout>
</LinearLayout>
</LinearLayout>

Categories