Solution 1 :
Honestly Im not exactly sure if I understand you correctly. However did you try https://developer.android.com/reference/android/widget/ProgressBar? With that you can just add a field progress
to your item model, and in List adapter do something like progressBar.setProgress(item.progress)
.
To update progress state just change value of progress
in item model and update the list.
Solution 2 :
seekBar.setPadding(0, 0, 0, 0);
make it programatically in your adapter class
Problem :
I’m making an android app.
I made an adaptor to make a list of views include an imageview and a textview first.
(I attached URL below here)
I would like to make the bar at the bottom of each adaptor fill in the color when I slide the entire view area.
I don’t know how, so I attached a seekbar at the bottom.
But I could only fill the color of the bar when I touch the bar area.
And as you see at the screenshot, there’s an afterimage when I slide the bar area.
How do I fill in the color when I touch the entire adapter view area?
And I’d also like to make the bar with no padding. (I made all padding parameter as 0dp, but it still has space in between as you see in the screenshot)
Thank you in advance.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns_android="http://schemas.android.com/apk/res/android"
android_layout_width="match_parent"
android_layout_height="wrap_content"
android_orientation="vertical"
android_background="#FFFFFF">
<LinearLayout
android_id="@+id/layout_habit"
android_layout_width="match_parent"
android_layout_height="wrap_content"
android_orientation="horizontal"
android_padding="16dp">
<ImageView
android_layout_width="wrap_content"
android_layout_height="wrap_content"
android_layout_gravity="center"
android_src="@drawable/ic_tool"/>
<TextView
android_id="@+id/habit_title"
android_layout_width="wrap_content"
android_layout_height="wrap_content"
android_layout_marginLeft="16dp"
android_textColor="#3F4047"
android_textStyle="bold"
android_layout_gravity="center"
android_text="A"/>
<TextView
android_id="@+id/habit_status"
android_layout_width="match_parent"
android_layout_height="wrap_content"
android_layout_marginRight="10dp"
android_text="done"
android_layout_gravity="center"
android_gravity="right"/>
</LinearLayout>
<SeekBar
android_id="@+id/seekBar"
android_layout_below="@id/layout_habit"
android_layout_width="match_parent"
android_layout_height="wrap_content"
android_paddingStart="0dp"
android_paddingEnd="0dp"
android_paddingTop="0dp"
android_paddingBottom="0dp"
android_thumb="@null"
android_fadingEdgeLength="0dp"
android_focusableInTouchMode="false"
android_splitTrack="false"/>
</RelativeLayout>
- Screenshot: https://i.stack.imgur.com/wW2hx.jpg
Comments
Comment posted by Jenny
Thanks for the answer. I want to fill the bar with sliding the whole adapter area. not just touching the bar. Is it possible to make the adapter touchable and update the value of the bar? As you can see on a screenshot, an adaptor includes an imageview, 2 textview, and a bar at the bottom.