Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set wave color #40

Open
stevdza-san opened this issue Nov 19, 2017 · 5 comments
Open

Set wave color #40

stevdza-san opened this issue Nov 19, 2017 · 5 comments

Comments

@stevdza-san
Copy link

Hello there, first of all thank you for providing this library, it's very nice. But I have one issue, whenever I try to declare wave color programmatically with setWaveColor(R.color.myColor) I don't get that color, and instead I get some other color. But when I declare in XML file it works...

@tangqi92
Copy link
Owner

Hi CyberWarriorZ,

Can you show me your code?

@stevdza-san
Copy link
Author

stevdza-san commented Nov 20, 2017

I used that code in my fragment.

@Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_battery, container, false);

 WaveLoadingView waveView = view.findViewById(R.id.waveLoadingView);
        waveView.setBottomTitleColor(R.color.colorPrimaryDark);
        waveView.setWaveColor(R.color.greenDark);
return view;
}

And my layout:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    tools:context="com.deviceinfo.fragments.BatteryFragment"
    android:orientation="vertical">

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:layout_marginTop="8dp"
        android:orientation="vertical">

        <me.itangqi.waveloadingview.WaveLoadingView
            android:id="@+id/waveLoadingView"
            android:layout_width="120dp"
            android:layout_height="120dp"
            app:wlv_borderWidth="3dp"
            app:wlv_shapeType="circle"
            app:wlv_round_rectangle="true"
            app:wlv_triangle_direction="north"
            app:wlv_titleCenterStrokeWidth="3dp"
            app:wlv_titleCenter="Center Title"
            app:wlv_titleCenterSize="24sp"
            app:wlv_waveAmplitude="70"/>

    </LinearLayout>

    <ListView
        android:scrollbars="none"
        android:id="@+id/listViewBattery"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginTop="8dp"
        android:layout_marginEnd="8dp"
        android:layout_marginStart="8dp"
        android:layout_marginBottom="8dp"/>

</LinearLayout>

@stevdza-san
Copy link
Author

stevdza-san commented Nov 20, 2017

Whenever I try to change the color to something else I get purple color...

@moolight-seashell
Copy link

same problem

@3bdelrahmansamir
Copy link

use "getResource().getColor(R.color.colorPrimaryDark)" instead of "R.color.colorPrimaryDark" and it will work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants