android - ProgressBar gets cut off -


so, trying wrap around circular progressbar around textview. whenever this, gets cut-off (how depends on device), , there ridiculous padding between left side of screen , progressbar. how want like:

http://imgur.com/jffxpip

the image android studio preview (dont know why works there)

however reasons looks (samsung s8):

http://imgur.com/kaztl4u

on oneplus 1 more on right , more cut off. android:layout_marginleft="-xxdp" can move cut off part progress bar, left want to, since margin depends quite hard on device, prefer use alternative way (and doesnt restore full progressbar).

and here complete xml code:

<relativelayout         android:id="@+id/top_bar_relative_layout"         android:layout_width="match_parent"         android:layout_height="match_parent"         android:layout_weight="6"         android:background="@color/blue_top_bar">          <relativelayout             android:layout_width="wrap_content"             android:layout_height="wrap_content">              <progressbar                 android:id="@+id/bartimer"                 style="?android:attr/progressbarstylehorizontal"                 android:layout_width="85dp"                 android:layout_height="85dp"                 android:indeterminate="false"                 android:max="500"                 android:layout_alignparentleft="true"                 android:visibility="visible"                 android:progress="500"                 android:progressdrawable="@drawable/circle_progress_bar" />              <textview                 android:id="@+id/countdown_gameplay"                 android:layout_width="wrap_content"                 android:textstyle="bold"                 android:layout_height="wrap_content"                 android:text="5"                 android:layout_centerinparent="true"                 android:textcolor="@color/white"                 android:textsize="20sp" />          </relativelayout>          <view             android:id="@+id/view"             android:layout_width="match_parent"             android:layout_height="2dp"             android:layout_alignparentbottom="true"             android:background="@color/chicken_yellow" />     </relativelayout> 

edit:

just found out has java code:

animation = new rotateanimation(0.0f, 90.0f, 250f, 273f);         an.setfillafter(true);         bartimer.startanimation(an); 

it seems rotateanimation reason problem. idea how change this, still rotates bar 90° degress, without cutting off , adding random padding?

appreciate ty

try adding realtivelayout of xml file:

<progressbar     android:id="@+id/progressbar1"     android:indeterminate="true"     style="?android:attr/progressbarstylelarge"     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:layout_margintop="87dp" />  <textview     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:text="5 s"     android:id="@+id/txt_secondsleft"     android:layout_alignright="@+id/progressbar1"     android:layout_alignleft="@+id/progressbar1"     android:gravity="center"     android:layout_alignbottom="@+id/progressbar1"     android:layout_aligntop="@+id/progressbar1"     /> 

hope serves purpose....


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -