Skip to content

Commit 1172969

Browse files
committed
commit
1 parent 6db5d28 commit 1172969

File tree

3 files changed

+11
-12
lines changed

3 files changed

+11
-12
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
```
1515

1616
##### 1.参数的控制
17-
![image](https://github.com/DingMouRen/PaletteImageView/raw/master/screenshot/demo1.gif)   
18-
![image](https://github.com/DingMouRen/PaletteImageView/raw/master/screenshot/demo2.gif)   
19-
![image](https://github.com/DingMouRen/PaletteImageView/raw/master/screenshot/demo3.gif)
17+
圆角半径|阴影半径|阴影偏移量
18+
---|---|---
19+
![image](https://github.com/DingMouRen/PaletteImageView/raw/master/screenshot/demo1.gif) | ![image](https://github.com/DingMouRen/PaletteImageView/raw/master/screenshot/demo2.gif) | ![image](https://github.com/DingMouRen/PaletteImageView/raw/master/screenshot/demo3.gif)
2020

2121
##### 2.阴影颜色默认是图片的主色调
2222

app/src/main/java/com/dingmouren/smaple/paletteimageview/SampleTwoActivity.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public ViewHolder(View itemView) {
6868
mLinearLayout = (LinearLayout)itemView. findViewById(R.id.linear);
6969
title = (TextView)itemView. findViewById(R.id.tv1);
7070
content = (TextView) itemView.findViewById(R.id.tv2);
71-
// initListener();
71+
initListener();
7272
}
7373

7474
private void initListener() {
@@ -94,10 +94,11 @@ public void onComplete(PaletteImageView paletteImageView) {
9494
if (arry == null) list.remove(arry);
9595
}
9696
int[] arry = list.get(new Random().nextInt(list.size()-1));
97-
98-
title.setTextColor(arry[1]);
99-
content.setTextColor(arry[0]);
100-
mLinearLayout.setBackgroundColor(arry[2]);
97+
if(arry != null) {
98+
title.setTextColor(arry[1]);
99+
content.setTextColor(arry[0]);
100+
mLinearLayout.setBackgroundColor(arry[2]);
101+
}
101102
}
102103

103104
@Override

app/src/main/res/layout/item_sample_two.xml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,14 @@
1212
android:id="@+id/palette"
1313
android:layout_width="match_parent"
1414
android:layout_height="wrap_content"
15-
app:palettePadding="20dp"
16-
app:paletteOffsetX="15dp"
17-
app:paletteOffsetY="15dp"
15+
app:palettePadding="0dp"
1816
/>
1917
<LinearLayout
2018
android:id="@+id/linear"
2119
android:layout_width="match_parent"
2220
android:layout_height="wrap_content"
2321
android:orientation="vertical"
24-
android:visibility="gone"
22+
android:visibility="visible"
2523
>
2624
<TextView
2725
android:id="@+id/tv1"

0 commit comments

Comments
 (0)