且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

以编程方式将ProgressBar添加到Android中的片段

更新时间:2023-01-05 11:34:57

您已使用 android:orientation ="horizo​​ntal" 指定了"linearLayoutCompletedOfficeHours"作为线性布局,并指定了textview Android:layout_width ="match_parent" .这样做会使textview占据整个空间,并且会创建进度条并将其显示在屏幕中.而是将textView的宽度更改为 android:layout_width ="wrap_content" ,进度将是可见的.

You have specified "linearLayoutCompletedOfficeHours" as a Linear Layout with android:orientation="horizontal" and given textview android:layout_width="match_parent".Making this will make textview to take entire space and progressbar is created and shown in the screen. Instead change textView width to android:layout_width="wrap_content" and the progress will be visible.

<TextView
   android:layout_width="wrap_content"
   android:layout_height="match_parent"
   android:id="@+id/completedXOfYDays" />