0

I would like to be able to use a custom progress bar like this here . It is meant to be a timer displayed in a fragment as I have a swipeable layout. I'm not very experienced in Android programming and I feel completely lost.

Any help would be really appreciated

FirstFragment.kt

class FirstFragment : Fragment() {

override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
                          savedInstanceState: Bundle?): View? {
    val rootView = inflater.inflate(R.layout.fragment_first, container, false)

    return rootView
}


companion object {
    /**
     * The fragment argument representing the section number for this
     * fragment.
     */
    private val ARG_SECTION_NUMBER = "section_number"

    /**
     * Returns a new instance of this fragment for the given section
     * number.
     */
    fun newInstance(sectionNumber: Int): FirstFragment {
        val fragment = FirstFragment()
        val args = Bundle()
        args.putInt(ARG_SECTION_NUMBER, sectionNumber)
        fragment.arguments = args
        return fragment
    }
}

}

In the xml of the first fragment I have added the object

<ProgressBar
        android:id="@+id/progressBar"
        style="?android:attr/progressBarStyleHorizontal"
        android:layout_width="350dp"
        android:layout_height="350dp"
        android:layout_centerInParent="true"
        android:indeterminate="false"
        android:max="100"
        android:progress="0"
        android:progressDrawable="@drawable/custom_progressbar_drawable"
        android:secondaryProgress="0" />
OneCricketeer
  • 179,855
  • 19
  • 132
  • 245

0 Answers0