그래서 SeekBar가 있지만 작은 원의 엄지 손가락은 잡기가 어렵습니다. 히트 박스를 더 크게 만들 수있는 방법이 있습니까? 그래픽 자체가 다르게 보일지는 필자가 신경 쓰지 않아도됩니다.Seekbar 엄지 손가락을 쉽게 잡으십시오.
0
A
답변
1
당신은 엄지 손가락의 크기를 변경하여, Andrew 응답에서 SeekBar를 사용자 정의 할 수 있습니다.
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape>
<size
android:height="40dp"
android:width="40dp" />
<solid android:color="@android:color/transparent" />
</shape>
</item>
<item android:drawable="@drawable/scrubber_control_normal_holo"/>
</layer-list>
thumb_image.xml 자리 같은 형상 층상 그리기를 만드는 예는 아래의 결과를 나타낸다.
<SeekBar
android:id="@+id/seekBar1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:thumb="@drawable/thumb_image" />
여기서 또 다른 좋은 예는 Thumb입니다.
0
체크 아웃 SeekBar를 DiscreteSeekBar이 멋진 라이브러리
뿐만 아니라 다음과 같은 특성이 있습니다 다음
<org.adw.library.widgets.discreteseekbar.DiscreteSeekBar
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:dsb_min="2"
app:dsb_max="15"
/>
에 의해 많은 복잡성없이 추가 할 수 있습니다. 도서관에서
dsb_progressColor: color/colorStateList for the progress bar and thumb drawable
dsb_trackColor: color/colorStateList for the track drawable
dsb_indicatorTextAppearance: TextAppearance for the bubble indicator
dsb_indicatorColor: color/colorStateList for the bubble shaped drawable
dsb_indicatorElevation: related to android:elevation. Will only be used on API level 21+
dsb_rippleColor: color/colorStateList for the ripple drawable seen when pressing the thumb. (Yes, it does a kind of "ripple" on API levels lower than 21 and a real RippleDrawable for 21+.
dsb_trackHeight: dimension for the height of the track drawable.
dsb_scrubberHeight: dimension for the height of the scrubber (selected area) drawable.
dsb_thumbSize: dimension for the size of the thumb drawable.
dsb_indicatorSeparation: dimension for the vertical distance from the thumb to the indicator.
다른 SeekBar 구성 요소는 these
0
삽입 가능한 드로어 블 리소스가 필요합니다. "ShapeDrawable 내의 오프셋 셰이프"https://stackoverflow.com/a/3674134/3175580에 대한이 대답은 같은 결과입니다. 다른 답변과 마찬가지로 대상 드로어 블이 비공개 인 경우에도 여전히 그 드로잉을 복사해야합니다.
이점 (또는 단점)은 총 크기 대신 크기를 얼마나 많이 늘리는지를 보여줍니다. 게다가 투명 셰이프를 사용하면 그 크기의 투명한 비트 맵 (?)이 만들어지기 때문에 메모리를 절약 할 수 있다고 생각합니다.
그 해결책을 시도했지만 "scrubber_control_normal_holo"를 찾을 수 없습니다. – KaliMa
여기에서 필요한 리소스를 다운로드 할 수 있습니다 : http://android-holo-colors.com/ 그리고 Drawable 폴더에 추가하십시오. –
@KaliMa 이것은 scrubber_control_normal_holo.png 이미지 이름입니다. 간단하고 작은 원 아이콘을 사용하고 scrubber_control_normal_holo로 이름을 지정하고 드로어 블에 넣고 위의 예를 사용하면 답을 얻을 수 있습니다. 시도해보십시오. 문제가 해결되면 대답하십시오. –