1

I have a rectangular image that I want to appear circular in an ImageView? I tried the following to no avail.

I create a circular xml shape and apply it as the background of my ImageView. Then I add the png image as the src of the ImageView. But the image still appears rectangular in a circular view. When I try to scale the image in the view, it simply fills the view and forces the view to look rectangular. Of course I just want to effectively get a circular cross-section of the image, losing all four straight edges. I welcome any help.

<ImageView android:id="@+id/circular_content"
        android:background="@drawable/bkg_circle_shape"
        android:src="@drawable/img_1"
        android:scaleType="fitCenter"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>

Shape:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:padding="10dp"
    android:shape="oval" >

    <solid android:color="#CCFFFFFF" />

    <size
        android:height="300dp"
        android:width="300dp" />

</shape>
learner
  • 11,490
  • 26
  • 97
  • 169

1 Answers1

0

try it splitTrack=-false in api21 or higher

for SeekBar, i test it work correctly.

Saeid
  • 2,261
  • 4
  • 27
  • 59