menu
This commit is contained in:
@@ -23,16 +23,7 @@ import butterknife.BindView;
|
||||
|
||||
public class RecipeActivity extends BaseActivity {
|
||||
|
||||
@BindView(R.id.recipe_list)
|
||||
RecyclerView recipeList;
|
||||
@BindView(R.id.nested_scorll_view)
|
||||
NestedScrollView nestedScorllView;
|
||||
@BindView(R.id.tv_title)
|
||||
TextView tvTitle;
|
||||
@BindView(R.id.tv_subTitle)
|
||||
TextView tvSubTitle;
|
||||
@BindView(R.id.ll_title)
|
||||
LinearLayout llTitle;
|
||||
|
||||
private RecommendFood recommendFood;
|
||||
private Menu menu;
|
||||
|
||||
@@ -52,20 +43,6 @@ public class RecipeActivity extends BaseActivity {
|
||||
public void initViews(Bundle savedInstanceState) {
|
||||
|
||||
final int changedHeight = UiUtils.dp2px(this, 214);
|
||||
nestedScorllView.setOnScrollChangeListener(new NestedScrollView.OnScrollChangeListener() {
|
||||
@Override
|
||||
public void onScrollChange(NestedScrollView v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) {
|
||||
|
||||
float scale = (float) v.getScrollY() / changedHeight;
|
||||
//变化范围0-255 表示从透明到纯色背景
|
||||
float alpha = scale * 255 >= 255 ? 255 : scale * 255;
|
||||
|
||||
llTitle.setBackgroundColor(Color.argb((int) alpha, 212, 62, 55));
|
||||
tvTitle.setTextColor(Color.argb((int) alpha, 255, 255, 255));
|
||||
tvSubTitle.setTextColor(Color.argb((int) alpha, 255, 255, 255));
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
Intent intent = getIntent();
|
||||
recommendFood = (RecommendFood) intent.getSerializableExtra("SEND_OBJECT");
|
||||
@@ -93,7 +70,5 @@ public class RecipeActivity extends BaseActivity {
|
||||
public void initRecyclerView() {
|
||||
super.initRecyclerView();
|
||||
MenuAdapter adapter = new MenuAdapter(menuList, this);
|
||||
recipeList.setAdapter(adapter);
|
||||
recipeList.setLayoutManager(new LinearLayoutManager(this));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user