0

In my widget I've an image of a refresh icon and circular progress bar (CPB) that is showed when the refresh icon is pressed (obviously only one view can be showed in the same time). The CPB is too big, so I try to set scaleX and scaleY to 0.7 and my CPB is smaller, but this had the side effect that there is empty space where there was a bigger CPB.

How do I set this 2 view in the same position with the same height and width?

    <FrameLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" 
        android:orientation="horizontal"
        android:layout_gravity="right"
        >        
        <ImageView
            android:id="@+id/imageView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/navigation_refresh" />

        <ProgressBar
            android:id="@+id/progressBar1"
            android:scaleX="0.7"
            android:scaleY="0.7"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            />
    </FrameLayout>

I can remove the scale and force the frame layout width and height to 28dp for example, and in this way it works fine, but I'm not sure if this is the best practice to do. (For example in this way in a tablet with a big screen maybe the images will be a little big bigger because I'm using "dp", but not of the right size. Am I wrong?)

canova
  • 3,965
  • 2
  • 22
  • 39
Accollativo
  • 1,537
  • 4
  • 32
  • 56

1 Answers1

0

I managed to set views at the same location UNINTENTIONALLY using relative layout.

Try surround the views you want to be on top of each other with relativelayout.

Makketronix
  • 1,389
  • 1
  • 11
  • 31
  • Putting them in a FrameLayout bring them to the exactly same spot, the problem is that they don't have the same dimension. – Accollativo Mar 23 '14 at 16:27