WaveLoadingView icon indicating copy to clipboard operation
WaveLoadingView copied to clipboard

Set wave color

Open stevdza-san opened this issue 8 years ago • 5 comments
trafficstars

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...

stevdza-san avatar Nov 19 '17 15:11 stevdza-san

Hi CyberWarriorZ,

Can you show me your code?

tangqi92 avatar Nov 20 '17 08:11 tangqi92

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 avatar Nov 20 '17 20:11 stevdza-san

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

stevdza-san avatar Nov 20 '17 20:11 stevdza-san

same problem

moolight-seashell avatar Apr 16 '19 11:04 moolight-seashell

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

3bdelrahmansamir avatar Oct 10 '21 09:10 3bdelrahmansamir