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 8746231
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:09:45+00:00 2026-06-13T12:09:45+00:00

I don’t know why, but layout is shown well on device with Api 11+,

  • 0

I don’t know why, but layout is shown well on device with Api 11+, isn’t for older.

This is xml:

    <LinearLayout
        android:id="@+id/workers_linearlayout"
        android:layout_width="50dp"
        android:layout_height="70dp"
        android:layout_weight="1" >

        <RelativeLayout
            android:id="@+id/workers_relative_layout"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:gravity="center" >

            <ImageView
                android:id="@+id/imageView1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerInParent="true"
                android:src="@drawable/workers_small" />

            <ImageView
                android:id="@+id/imageView3"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:layout_centerInParent="true"
                android:scaleX="0.5"
                android:scaleY="0.5"
                android:src="@drawable/ic_cerchio_rosso"
                android:translationX="25dp"
                android:translationY="-20dp" />

            <TextView
                android:id="@+id/workers_number"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerInParent="true"
                android:text="9"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:translationX="25dp"
                android:translationY="-20dp" />
        </RelativeLayout>
    </LinearLayout>

This is result on API 11+:

Api11+

This on API 10-:

API 10-

I tried to fix it playing with layouts and I can obtain a quite good result, but never like the first one.

Can someone help me?

EDIT:

Photo on devices:

enter image description here

EDIT2

Triangle warning are:

  • String “9” should use string resource
  • ImageView1 and 3: missing content description attribute
  • RelativeLayout or it’s parent possibly useless
  • Nested weights are bad for performance

By the way, nothing of these fixed solving my problem i think

  • 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-13T12:09:46+00:00Added an answer on June 13, 2026 at 12:09 pm

    Ok. I fixed it. Playing with the layout and following NikkyD’s suggestion about “center in parent” feature, I followed this policy:

    It’s not possible to use scale and translation properties because older Apis (maybe) don’t recognize them. So, I deleted translation and scaling options and scaled image by setting a fixed height and width for IV3 (30dpx30dp). Now dimension is right, but if I call “align parent Top” with “align parent Right” for IV3 and TextView, their position is good, but TextView is not positioned at the center of IV3. Exactly like this:

    Wrong number position

    For fixing it, I added a new relative layout inside “workersRelativeLayout” and I put inside it IV3 and TextView and set, for each one, “center in the parent” to TRUE. Then, I set for a new relative layout “align parent Top” and “align parent Right”. This is the final result:

    Right number position

    This is new xml layout:

                <LinearLayout
                    android:id="@+id/workers_linearlayout"
                    android:layout_width="50dp"
                    android:layout_height="70dp"
                    android:layout_weight="1" >
    
                    <RelativeLayout
                        android:id="@+id/workers_relative_layout"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:gravity="center" >
    
                        <ImageView
                            android:id="@+id/imageView1"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_centerInParent="true"
                            android:src="@drawable/workers_small" />
    
                        <RelativeLayout
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_alignParentRight="true"
                            android:layout_alignParentTop="true" >
    
                            <ImageView
                                android:id="@+id/imageView3"
                                android:layout_width="30dp"
                                android:layout_height="30dp"
                                android:layout_centerInParent="true"
                                android:src="@drawable/ic_cerchio_rosso" />
    
    
                            <TextView
                                android:id="@+id/workers_number"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_centerInParent="true"
                                android:text="9"
                                android:textAppearance="?android:attr/textAppearanceMedium" />
    
                        </RelativeLayout>
                    </RelativeLayout>
                </LinearLayout>
    

    Hope this helps someone 🙂

    EDIT

    Pay attention to parent width size. If you set weight’s parent to 1, naturally size is dynamic according to display size. The image is positioned always at the center parent and relative Layout of IV3 and TextView will be always top|right. So if parent width size grows, the distance between image centered and new relative layout grows too, and can happen something like this:

    enter image description here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I don't know why, but this code worked for me a month ago... maybe
I don't know if this question is trivial or not. But after a couple
Don't know if this is the right place to ask this, but I will
Don't know why this is happening, but after submitting a form via JS (using
(Don't know if this is strictly on-topic, but I don't see any better Stack
Don't know if this is an eclipse specific problem but whenever I declare a
Don't know if I'm over-thinking this or not.. but I'm trying to be able
Don't know why but I can't find a solution to this. I have 3
don't know better title for this, but here's my code. I have class user
Don't know how to frase this but I found this code wich works as

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.