SeeOrderView.java
1.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package com.lijinji.part.widget;
import android.content.Context;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.lijinji.part.R;
public class SeeOrderView extends LinearLayout {
boolean show = true;
TextView see_title, see_text;
public SeeOrderView(Context context) {
super(context);
initView(context);
}
public SeeOrderView(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
initView(context);
}
public SeeOrderView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
initView(context);
}
private void initView(Context context) {
View view = LayoutInflater.from(context).inflate(R.layout.layout_see_order, this);
LinearLayout see_layout = view.findViewById(R.id.see_layout);
final ImageView see_image = view.findViewById(R.id.see_image);
see_title = view.findViewById(R.id.see_title);
final LinearLayout see_linear = view.findViewById(R.id.see_linear);
see_text = view.findViewById(R.id.see_text);
see_layout.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
if(show) {
show = false;
see_linear.setVisibility(View.GONE);
see_image.setImageResource(R.mipmap.pull_down);
} else {
show = true;
see_linear.setVisibility(View.VISIBLE);
see_image.setImageResource(R.mipmap.pull_top);
}
}
});
}
public void setSeeTitle(String str) {
see_title.setText(str);
}
public void setSeeMessage(String str) {
see_text.setText(str);
}
}