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

  • Home
  • SEARCH
  • 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 7082097
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:00:15+00:00 2026-05-28T07:00:15+00:00

I have a layout with a textview and an imageview in the same line.

  • 0

I have a layout with a textview and an imageview in the same line.

If text is too long it goes over the imageview.
I use layout as wrap_content.

Any idea how to fix it?

I want to do it without specifying a width in pixels.

Problem is with the @+id/ShowRecipe_RecipeNameId and the @+id/ShowRecipe_PTimeImageViewId
Here is the XML:

    <?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_height="match_parent"
    android:layout_width="match_parent"
    android:orientation="vertical"
    android:background="@drawable/main_bg" >


    <RelativeLayout
        android:orientation="vertical"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

        <TextView
            android:id="@+id/ShowRecipe_RecipeNameId"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignTop="@+id/ShowRecipe_PTimeImageViewId" 
            android:layout_alignParentLeft="true"
            android:layout_marginLeft="5dp"
            android:textColor="@color/header_orange"
            android:text="RecipeName"
            android:textSize="21dip" />

        <TextView
            android:id="@+id/ShowRecipe_AuthorId"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignLeft="@+id/ShowRecipe_RecipeNameId"
            android:layout_below="@+id/ShowRecipe_RecipeNameId"
            android:layout_alignTop="@+id/ShowRecipe_DifficultyImageViewId" 
            android:textColor="@color/author_blue"
            android:text="Author"
            android:textSize="21dip" />

        <ImageView 
            android:layout_height="wrap_content" 
            android:layout_width="wrap_content" 
            android:src="@drawable/add_to_favourite"
            android:layout_alignParentRight="true"
            android:layout_marginTop="5dp"
            android:layout_marginRight="5dp"
            android:id="@+id/addRemoveFromFavouritesImageViewId" />

<!--    <ImageView 
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content" 
            android:src="@drawable/refresh_button"
            android:id="@+id/ShowRecipe_RefreshImageViewId" 
            android:layout_alignTop="@+id/addRemoveFromFavouritesImageViewId" 
            android:layout_toLeftOf="@+id/addRemoveFromFavouritesImageViewId"
            android:layout_marginRight="5dp" /> -->

        <ImageView 
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content" 
            android:src="@drawable/rate_recipe_button"
            android:id="@+id/ShowRecipe_RateImageViewId" 
            android:layout_toLeftOf="@+id/addRemoveFromFavouritesImageViewId"
            android:layout_alignTop="@+id/addRemoveFromFavouritesImageViewId" 
            android:layout_marginRight="5dp" />

        <ImageView 
            android:src="@drawable/time_icon" 
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content"
            android:layout_below="@+id/ShowRecipe_RateImageViewId"
            android:layout_alignRight="@+id/addRemoveFromFavouritesImageViewId"
            android:layout_marginTop="10dp"
            android:id="@+id/ShowRecipe_PTimeImageViewId" />

        <ImageView 
            android:src="@drawable/difficulty_hard_icon" 
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content"
            android:layout_below="@+id/ShowRecipe_PTimeImageViewId"
            android:layout_alignLeft="@+id/ShowRecipe_PTimeImageViewId"
            android:layout_marginTop="5dp"
            android:id="@+id/ShowRecipe_DifficultyImageViewId" />

    </RelativeLayout>


    <TabHost 
        android:id="@android:id/tabhost"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_below="@+id/ShowRecipe_RatingBarId" >

        <LinearLayout
            android:orientation="vertical"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:padding="5dp">

            <FrameLayout 
                android:id="@android:id/tabcontent" 
                android:padding="5dp" 
                android:layout_height="match_parent" 
                android:layout_width="match_parent"
                android:layout_weight="1" />

            <TabWidget
                android:id="@android:id/tabs"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:background="@drawable/recipe_book_tabs_bg"
                android:layout_gravity="bottom" />
        </LinearLayout>
    </TabHost>

</LinearLayout>
  • 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-05-28T07:00:16+00:00Added an answer on May 28, 2026 at 7:00 am

    I think by putting this android:layout_toLeftOf="@+id/ShowRecipe_PTimeImageViewId" on the TextView and making that TextView width to fill_parent will solve the issue. I have modified the xml. Kindly check:

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical" 
        android:background="@drawable/main_bg">
    
        <RelativeLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="vertical" >
    
            <TextView
                android:id="@+id/ShowRecipe_RecipeNameId"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                android:layout_alignTop="@+id/ShowRecipe_PTimeImageViewId"
                android:layout_marginLeft="5dp"
                android:text="RecipeName"
                android:layout_toLeftOf="@+id/ShowRecipe_PTimeImageViewId"
                android:layout_alignLeft="@+id/ShowRecipe_PTimeImageViewId"
                android:textSize="21dip" />
    
            <TextView
                android:id="@+id/ShowRecipe_AuthorId"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignLeft="@+id/ShowRecipe_RecipeNameId"
                android:layout_alignTop="@+id/ShowRecipe_DifficultyImageViewId"
                android:layout_below="@+id/ShowRecipe_RecipeNameId"
                android:text="Author"
                android:textSize="21dip" />
    
            <ImageView
                android:id="@+id/addRemoveFromFavouritesImageViewId"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentRight="true"
                android:layout_marginRight="5dp"
                android:layout_marginTop="5dp"
                android:src="@drawable/icon" />
    
            <!--
            <ImageView 
                android:layout_width="wrap_content" 
                android:layout_height="wrap_content" 
                android:src="@drawable/refresh_button"
                android:id="@+id/ShowRecipe_RefreshImageViewId" 
                android:layout_alignTop="@+id/addRemoveFromFavouritesImageViewId" 
                android:layout_toLeftOf="@+id/addRemoveFromFavouritesImageViewId"
                android:layout_marginRight="5dp" />
            -->
    
            <ImageView
                android:id="@+id/ShowRecipe_RateImageViewId"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignTop="@+id/addRemoveFromFavouritesImageViewId"
                android:layout_marginRight="5dp"
                android:layout_toLeftOf="@+id/addRemoveFromFavouritesImageViewId"
                android:src="@drawable/icon" />
    
            <ImageView
                android:id="@+id/ShowRecipe_PTimeImageViewId"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignRight="@+id/addRemoveFromFavouritesImageViewId"
                android:layout_below="@+id/ShowRecipe_RateImageViewId"
                android:layout_marginTop="10dp"
                android:src="@drawable/icon" />
    
            <ImageView
                android:id="@+id/ShowRecipe_DifficultyImageViewId"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignLeft="@+id/ShowRecipe_PTimeImageViewId"
                android:layout_below="@+id/ShowRecipe_PTimeImageViewId"
                android:layout_marginTop="5dp"
                android:src="@drawable/icon" />
        </RelativeLayout>
        <TabHost
            android:id="@android:id/tabhost"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_below="@+id/ShowRecipe_RatingBarId" >
    
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="vertical"
                android:padding="5dp" >
    
                <FrameLayout
                    android:id="@android:id/tabcontent"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_weight="1"
                    android:padding="5dp" />
    
                <TabWidget
                    android:id="@android:id/tabs"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:layout_gravity="bottom"
                     />
            </LinearLayout>
        </TabHost>
    </LinearLayout>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following TextView in my XML layout file:- <TextView android:layout_width=fill_parent android:layout_height=wrap_content android:text=@string/autolink_test
I have a layout which contains some views like this: <LinearLayout> <TextView...> <TextView...> <ImageView
My layout have ImageView(iv) and TextView(tv). I want to let the tv right of
I have the following ImageView and TextView: Here is the XML: <LinearLayout android:layout_height=wrap_content android:layout_width=match_parent
I have a background image child inside a relative layout: <ImageView android:layout_width=wrap_content android:layout_height=wrap_content android:scaleType=centerInside
I have this custom layout: - LinearLayout - FrameLayout - ImageView - TextView This
I have a layout with the following structure: LinearLayout_1 ImageView TextView Linearlayout_2 ImageView TextView
can you have a layout with an imageview and textview for a row in
I have a relative layout that has an ImageView and and a textview aligned
i have a textview and imageview inside a linearlayout. textview containes more text so

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.