Android ProgressBar被切断了
因此,我试图将圆形进度条环绕在文本视图上。每当我这样做的时候,它就会被切断(多少取决于设备),屏幕左侧和Android ProgressBar被切断了,android,xml,Android,Xml,因此,我试图将圆形进度条环绕在文本视图上。每当我这样做的时候,它就会被切断(多少取决于设备),屏幕左侧和ProgressBar之间也有一个荒谬的填充。 这就是我希望它看起来的样子: 该图像实际上来自android studio预览版(不知道为什么会在那里工作) 然而,出于某些原因,它看起来像这样(三星S8): 在“一加一”上,它更靠近右边,甚至更为封闭。 使用android:layout_marginleft=“-xxdp”我可以将被切断的部分从进度条移到我想要的左边,但是由于边距很难根据设
ProgressBar
之间也有一个荒谬的填充。
这就是我希望它看起来的样子:
该图像实际上来自android studio预览版(不知道为什么会在那里工作)
然而,出于某些原因,它看起来像这样(三星S8):
在“一加一”上,它更靠近右边,甚至更为封闭。
使用android:layout_marginleft=“-xxdp”我可以将被切断的部分从进度条移到我想要的左边,但是由于边距很难根据设备来确定,我更愿意使用另一种方式(这也不会恢复完整的进度条)
下面是完整的xml代码:
<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>
似乎旋转运动是问题的原因。有人知道如何改变这一点,使它仍然旋转酒吧90度,而不切断和添加一个随机填充
谢谢你的帮助
ty尝试将其添加到
XML
文件的reactivelayout
:
<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"
/>
希望它能满足您的需要….尝试将其添加到
XML
文件的reactivelayout
:
<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"
/>
希望它能达到你的目的