WaveLoadingView
WaveLoadingView copied to clipboard
Set wave color
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...
Hi CyberWarriorZ,
Can you show me your code?
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>
Whenever I try to change the color to something else I get purple color...
same problem
use "getResource().getColor(R.color.colorPrimaryDark)" instead of "R.color.colorPrimaryDark" and it will work