Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9045853
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T11:28:03+00:00 2026-06-16T11:28:03+00:00

I have an ImageView (the clock image in the screen shot below) that I’d

  • 0

I have an ImageView (the clock image in the screen shot below) that I’d like to center vertically to the timestamp text (“2 hours ago” in the image) no matter what the text size.

enter image description here

I’ve tried android:layout_centerVertical="true" but it has no effect.

I’ve included the layout code below. What would be the right way to center the clock (id createdTimeImage) vertically to the timestamp text (id createdTime) in a RelativeLayout? Appreciate any pointers in the right direction.

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

<RelativeLayout
    android:id="@+id/fromPictureSection"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="@drawable/square_shape_grey_border"
    android:padding="1dip"
    android:layout_marginLeft="10dip"
    android:layout_marginTop="10dip" >

    <ImageView
        android:id="@+id/fromPicture"
        android:layout_width="50dip"
        android:layout_height="50dip"
        android:contentDescription="@null" />
</RelativeLayout>

<TextView
    android:id="@+id/fromName"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_toRightOf="@id/fromPictureSection"
    android:paddingLeft="5dip"
    android:paddingRight="10dip"
    android:paddingTop="12dip"
    android:textAppearance="@style/bodyTextStyle" />

<ImageView
    android:id="@+id/createdTimeImage"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@id/fromName"
    android:layout_toRightOf="@id/fromPictureSection"
    android:contentDescription="@null"
    android:paddingBottom="0dip"
    android:paddingLeft="5dip"
    android:paddingTop="0dip"
    android:layout_centerVertical="true"
    android:src="@drawable/clock" />

<TextView
    android:id="@+id/createdTime"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_below="@id/fromName"
    android:layout_toRightOf="@id/createdTimeImage"
    android:layout_centerVertical="true"
    android:paddingBottom="0dp"
    android:paddingLeft="2dip"
    android:paddingRight="10dip"
    android:paddingTop="0dp"
    android:textAppearance="@style/smallGreyTextStyle" />
</RelativeLayout>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T11:28:07+00:00Added an answer on June 16, 2026 at 11:28 am

    You can initialize an image to the textview itself

    <TextView
        android:id="@+id/createdTime"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/fromName"
        android:layout_toRightOf="@id/createdTimeImage"
        android:layout_centerVertical="true"
        android:paddingBottom="0dp"
        android:paddingLeft="2dip"
        android:paddingRight="10dip"
        android:paddingTop="0dp"
        android:textAppearance="@style/smallGreyTextStyle"
        android:drawableLeft="@drawable/clock" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a static background image (map) that loads in my ImageView. I have
I have an ImageView in my activity that shows an active symbol when a
I have an ImageView and TextView . I want to place the TextView below
I create a UIImageView as below imageView = [[UIImageView alloc] init]; imageView.image = [UIImage
Please Consider my below xml code and screen shot(To view the large screen shotplease
In my app i have a button that when click loads a new image
I have the below code in my getView. It populates an imageview with an
I have an imageview that moves up when i click a button. i want
I have an ImageView containing an image. This image is rotated by button clicks,
I have this image in the xml (and others elements): <ImageView android:clickable=true android:onClick=imageClick android:id=@+id/Decena0

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.