angcyo / DslTabLayout

:hearts: Android界最万能的TabLayout(不仅仅是TabLayout), 支持任意类型的item, 支持Drawable类型的指示器,智能开启滚动,支持横竖向布局等
https://github.com/angcyo/DslAdapter
MIT License
1.55k stars 145 forks source link

Hellp , How can I implement this feature #61

Closed NemoChen317 closed 2 years ago

NemoChen317 commented 2 years ago

https://imgur.com/wMX3ih8

I want to implement more setting feature

so can I do this ?

thank you

angcyo commented 2 years ago

What is the effect of clicking on more items?

NemoChen317 commented 2 years ago

can you see image url?

show small pop window to show other hide item when click more item

NemoChen317 commented 2 years ago

here is the image link https://imgur.com/VmdgbYd

angcyo commented 2 years ago

image

What is the effect of clicking these items?

NemoChen317 commented 2 years ago

the more item text became click item's text and number
and the arrow still there

thanks for your answer

angcyo commented 2 years ago

more item, you can use popWindow.

NemoChen317 commented 2 years ago

Do you have support at your library? Or do I have to make my own?

angcyo commented 2 years ago

You can do it yourself.

NemoChen317 commented 2 years ago

ok thank you i will try it

angcyo commented 2 years ago

Thanks for using this library.

NemoChen317 commented 2 years ago

sorry

I have a question this is Normal is also what I want of indicator https://imgur.com/a/gG4xEAv

But the last one is a little bit shifted https://imgur.com/FU9aIL8

I want my indicator center form TextView on bottom It would be better if it could be based on TextView width

can i solve it ? thank you

my code

<com.angcyo.tablayout.DslTabLayout
            android:id="@+id/states_tab_layout"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"
            android:minHeight="50dp"
            android:background="@android:color/transparent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@+id/tab_layout"
            app:tab_convex_background="@android:color/white"
            app:tab_deselect_color="#80454545"
            app:tab_indicator_color="@color/color_mommy_style"
            app:tab_indicator_drawable="@color/color_mommy_style"
            app:tab_select_color="@color/color_mommy_style"
            app:tab_indicator_width="50dp"
            tools:tab_default_index="0">

            <com.mommyhappy.mhclient.view.service.component.ServiceStatesTab
                android:id="@+id/not_service_tab"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                app:mommy_state_title="@string/service_count_tab_not_service"/>

            <com.mommyhappy.mhclient.view.service.component.ServiceStatesTab
                android:id="@+id/serviced_tab"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                app:mommy_state_title="@string/service_count_tab_serviced"/>

            <com.mommyhappy.mhclient.view.service.component.ServiceStatesTab
                android:id="@+id/service_total_tab"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                app:mommy_state_title="@string/service_count_tab_total"/>

            <com.mommyhappy.mhclient.view.service.component.ServiceStatesTab
                android:id="@+id/more_tab"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                app:mommy_state_title="@string/service_count_tab_total"
                app:mommy_arrow_show="true"
                app:mommy_count_show="true"/>

        </com.angcyo.tablayout.DslTabLayout>
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools">

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:paddingLeft="17dp"
        android:orientation="horizontal">

        <TextView
            android:id="@+id/states_tv"
            style="@style/ServiceCountTabStyle"
            android:text="@string/service_count_tab_not_service" />

        <TextView
            android:id="@+id/count_tv"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textSize="12dp"
            android:textColor="@color/color_mommy_style"
            android:alpha="0.5"
            android:text="34"
            android:layout_gravity="center"
            android:layout_marginBottom="4dp"
            android:layout_marginLeft="2dp"
            tools:text="34"/>

        <ImageView
            android:id="@+id/arrow_tv"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:visibility="gone"
            android:src="@drawable/ic_arrow_down"/>
    </LinearLayout>
</layout>
angcyo commented 2 years ago

if you use app:tab_indicator_width="50dp" way, you need to fixed the width of count_tv and set app:tab_indicator_x_offset.

example:

<TextView
    android:id="@+id/count_tv"
    android:layout_width="10dp"
    .../>

app:tab_indicator_x_offset="-10dp"

you can also use:

app:tab_indicator_width="WRAP_CONTENT"
app:tab_indicator_content_id="@id/states_tv"
NemoChen317 commented 2 years ago

Thanks for your answer

but i can't find tab_indicator_content_index i just find app:tab_indicator_content_index

and i try app:tab_indicator_content_index="@+id/states_tv"

the view show is. indicator width is tha same with states_tv + count_tv ' width but i hope is just states_tv ' width

ps. states_tv and count_tv width is. Wrap_content

angcyo commented 2 years ago
implementation 'com.github.angcyo.DslTablayout:TabLayout:3.2.1'
<com.angcyo.tablayout.DslTabLayout
    app:tab_indicator_content_id="@+id/states_tv"
    app:tab_indicator_width="WRAP_CONTENT"
    ...>
NemoChen317 commented 2 years ago

Great, thank you very much for your reply! I'm trying to finish that UI feature Now popupWindow is almost done The only thing left is to click on the replacement Tab text feature

angcyo commented 2 years ago

good luck!

NemoChen317 commented 2 years ago

complete https://youtu.be/MMPCUASWz-M

thank you for your help Very good library for use

angcyo commented 2 years ago

Have Fun!