Skip to content

Commit

Permalink
feat: add scrollbar style to candidate view
Browse files Browse the repository at this point in the history
Currently candidate view use the default style in Android OS,
which varies in different manufacturer.  Adding a style to it
so that it has the same scrollbar on different Android model.
  • Loading branch information
goofyz committed Dec 30, 2023
1 parent ca1b607 commit bb43b61
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
7 changes: 7 additions & 0 deletions app/src/main/res/drawable/candidate_scrollbar_thumb.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<size android:height="4dp" android:width="12dp" />
<solid android:color="#66666666" />
<corners android:radius="4dp"/>
</shape>
2 changes: 1 addition & 1 deletion app/src/main/res/layout/candidate_bar.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
android:id="@+id/candidate_root"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
style="@style/candidate_scrollBar"
android:fillViewport="true">

<LinearLayout
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/input_loading.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
10 changes: 10 additions & 0 deletions app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="candidate_scrollBar">
<item name="android:scrollbarSize">4dp</item>
<item name="android:scrollbarStyle">outsideOverlay</item>
<item name="android:scrollbars">horizontal</item>
<item name="android:fadeScrollbars">true</item>
<item name="android:scrollbarThumbHorizontal">@drawable/candidate_scrollbar_thumb</item>
</style>
</resources>

0 comments on commit bb43b61

Please sign in to comment.