result
This commit is contained in:
@@ -83,4 +83,7 @@ dependencies {
|
||||
// json解析库
|
||||
implementation 'com.google.code.gson:gson:2.8.5'
|
||||
|
||||
//横向picker
|
||||
compile 'com.github.adityagohad:HorizontalPicker:1.0.1'
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.example.ninefourone.nutritionmaster.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.example.ninefourone.nutritionmaster.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* Created by ScorpioMiku on 2018/10/5.
|
||||
*/
|
||||
|
||||
public class PickerAdapter extends RecyclerView.Adapter<PickerHolder> {
|
||||
private ArrayList<String> list;
|
||||
private Context context;
|
||||
|
||||
public PickerAdapter(ArrayList<String> list, Context context) {
|
||||
super();
|
||||
this.list = list;
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PickerHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(context).inflate(R.layout.picker_item, parent, false);
|
||||
return new PickerHolder(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(PickerHolder holder, int position) {
|
||||
holder.bindView(list.get(position));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return list.size();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.example.ninefourone.nutritionmaster.adapter;
|
||||
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.example.ninefourone.nutritionmaster.R;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
|
||||
/**
|
||||
* Created by ScorpioMiku on 2018/10/5.
|
||||
*/
|
||||
|
||||
public class PickerHolder extends RecyclerView.ViewHolder {
|
||||
@BindView(R.id.picker_item)
|
||||
TextView pickerItem;
|
||||
|
||||
public PickerHolder(View itemView) {
|
||||
super(itemView);
|
||||
ButterKnife.bind(this, itemView);
|
||||
}
|
||||
|
||||
public void bindView(String text) {
|
||||
pickerItem.setText(text);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.example.ninefourone.nutritionmaster.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.example.ninefourone.nutritionmaster.R;
|
||||
import com.example.ninefourone.nutritionmaster.bean.ClassifyResult;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import travel.ithaka.android.horizontalpickerlib.PickerLayoutManager;
|
||||
|
||||
/**
|
||||
* Created by ScorpioMiku on 2018/10/5.
|
||||
*/
|
||||
|
||||
public class ResultListAdapter extends RecyclerView.Adapter<ResultListHolder> {
|
||||
private ArrayList<ClassifyResult> mList;
|
||||
private Context context;
|
||||
private PickerLayoutManager pickerLayoutManager;
|
||||
|
||||
public ResultListAdapter(ArrayList<ClassifyResult> list, Context context) {
|
||||
super();
|
||||
mList = list;
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultListHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(context).inflate(R.layout.dish_result_item, parent, false);
|
||||
pickerLayoutManager = new PickerLayoutManager(context, PickerLayoutManager.HORIZONTAL, false);
|
||||
return new ResultListHolder(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(ResultListHolder holder, int position) {
|
||||
holder.bindView(mList.get(position), pickerLayoutManager);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mList.size();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.example.ninefourone.nutritionmaster.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.example.ninefourone.nutritionmaster.R;
|
||||
import com.example.ninefourone.nutritionmaster.bean.ClassifyResult;
|
||||
import com.github.siyamed.shapeimageview.CircularImageView;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import travel.ithaka.android.horizontalpickerlib.PickerLayoutManager;
|
||||
|
||||
/**
|
||||
* Created by ScorpioMiku on 2018/10/5.
|
||||
*/
|
||||
|
||||
public class ResultListHolder extends RecyclerView.ViewHolder {
|
||||
@BindView(R.id.image)
|
||||
ImageView image;
|
||||
@BindView(R.id.name)
|
||||
TextView name;
|
||||
@BindView(R.id.picker)
|
||||
RecyclerView picker;
|
||||
|
||||
private Context context;
|
||||
|
||||
public ResultListHolder(View itemView) {
|
||||
super(itemView);
|
||||
ButterKnife.bind(this, itemView);
|
||||
context = itemView.getContext();
|
||||
}
|
||||
|
||||
public void bindView(ClassifyResult classifyResult, PickerLayoutManager pickerLayoutManager) {
|
||||
pickerLayoutManager.setChangeAlpha(true);
|
||||
pickerLayoutManager.setScaleDownBy(0.99f);
|
||||
pickerLayoutManager.setScaleDownDistance(0.8f);
|
||||
picker.setLayoutManager(pickerLayoutManager);
|
||||
name.setText(classifyResult.getName());
|
||||
Glide.with(context).load("http://s2.boohee.cn/house/food_big/big_photo20155149534910631.jpg").into(image);
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,27 @@
|
||||
package com.example.ninefourone.nutritionmaster.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Created by ScorpioMiku on 2018/10/4.
|
||||
*/
|
||||
|
||||
public class ClassifyResult {
|
||||
public class ClassifyResult implements Serializable {
|
||||
|
||||
private String imgPath ;
|
||||
private String imgPath;
|
||||
private double probability;
|
||||
private String name;
|
||||
private int calorie;
|
||||
private double calorie;
|
||||
private Boolean has_calorie;
|
||||
private double quantity = -1;
|
||||
|
||||
public double getQuantity() {
|
||||
return quantity;
|
||||
}
|
||||
|
||||
public void setQuantity(double quantity) {
|
||||
this.quantity = quantity;
|
||||
}
|
||||
|
||||
public String getImgPath() {
|
||||
return imgPath;
|
||||
@@ -36,11 +47,11 @@ public class ClassifyResult {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public int getCalorie() {
|
||||
public double getCalorie() {
|
||||
return calorie;
|
||||
}
|
||||
|
||||
public void setCalorie(int calorie) {
|
||||
public void setCalorie(double calorie) {
|
||||
this.calorie = calorie;
|
||||
}
|
||||
|
||||
@@ -55,6 +66,5 @@ public class ClassifyResult {
|
||||
@Override
|
||||
public String toString() {
|
||||
return name + ";置信度" + probability + ";卡路里" + calorie;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.example.ninefourone.nutritionmaster.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* Created by ScorpioMiku on 2018/10/5.
|
||||
*/
|
||||
|
||||
public class ResultList implements Serializable {
|
||||
|
||||
private ArrayList<ClassifyResult> results;
|
||||
|
||||
public ResultList(ArrayList<ClassifyResult> results) {
|
||||
super();
|
||||
this.results = results;
|
||||
}
|
||||
|
||||
public ArrayList<ClassifyResult> getResults() {
|
||||
return results;
|
||||
}
|
||||
|
||||
public void setResults(ArrayList<ClassifyResult> results) {
|
||||
this.results = results;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用于Intent传递
|
||||
*/
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
String log = "";
|
||||
for (int i = 0; i < results.size(); i++) {
|
||||
log += results.get(i).getName() + ";卡路里" +results.get(i).getCalorie() + "\n";
|
||||
}
|
||||
return log;
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,8 @@ import android.widget.TextView;
|
||||
|
||||
import com.example.ninefourone.nutritionmaster.R;
|
||||
import com.example.ninefourone.nutritionmaster.bean.ClassifyResult;
|
||||
import com.example.ninefourone.nutritionmaster.bean.ResultList;
|
||||
import com.example.ninefourone.nutritionmaster.modules.classifyresult.DishResultActivity;
|
||||
import com.example.ninefourone.nutritionmaster.utils.ConstantUtils;
|
||||
import com.example.ninefourone.nutritionmaster.utils.MessageUtils;
|
||||
import com.example.ninefourone.nutritionmaster.utils.WebUtils;
|
||||
@@ -187,7 +189,7 @@ public class ClassifierCamera extends AppCompatActivity {
|
||||
classifyResult.setHas_calorie(jsonObject.getBoolean("has_calorie"));
|
||||
classifyResult.setProbability(jsonObject.getDouble("probability"));
|
||||
classifyResult.setName(jsonObject.getString("name"));
|
||||
Logger.d(classifyResult);
|
||||
// Logger.d(classifyResult);
|
||||
resultList.add(classifyResult);
|
||||
refreshUI();
|
||||
} catch (Exception e) {
|
||||
@@ -218,7 +220,13 @@ public class ClassifierCamera extends AppCompatActivity {
|
||||
cameraCoverLinearlayout.setVisibility(View.VISIBLE);
|
||||
break;
|
||||
case R.id.more_takephoto_ok:
|
||||
Intent intent = new Intent(ClassifierCamera.this, DishResultActivity.class);
|
||||
intent.putExtra("LIST", resultList);
|
||||
// intent.putExtra("LIST", ConstantUtils.testData);
|
||||
startActivity(intent);
|
||||
resultList.clear();
|
||||
refreshUI();
|
||||
finish();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,71 @@
|
||||
package com.example.ninefourone.nutritionmaster.modules.classifyresult;
|
||||
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.example.ninefourone.nutritionmaster.R;
|
||||
import com.example.ninefourone.nutritionmaster.adapter.ResultListAdapter;
|
||||
import com.example.ninefourone.nutritionmaster.base.BaseActivity;
|
||||
import com.example.ninefourone.nutritionmaster.bean.ClassifyResult;
|
||||
import com.example.ninefourone.nutritionmaster.utils.ConstantUtils;
|
||||
import com.orhanobut.logger.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import butterknife.BindView;
|
||||
|
||||
public class DishResultActivity extends BaseActivity {
|
||||
|
||||
@BindView(R.id.recycler_view)
|
||||
RecyclerView recyclerView;
|
||||
@BindView(R.id.calorie)
|
||||
TextView calorie;
|
||||
@BindView(R.id.suger)
|
||||
TextView suger;
|
||||
@BindView(R.id.fat)
|
||||
TextView fat;
|
||||
@BindView(R.id.protein)
|
||||
TextView protein;
|
||||
@BindView(R.id.ok_button)
|
||||
Button okButton;
|
||||
// private ResultList results;
|
||||
private ArrayList<ClassifyResult> results;
|
||||
private ResultListAdapter resultListAdapter;
|
||||
|
||||
public class DishResultActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_dish_result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLayoutId() {
|
||||
return R.layout.activity_dish_result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initViews(Bundle savedInstanceState) {
|
||||
Intent intent = getIntent();
|
||||
results = (ArrayList<ClassifyResult>) intent.getSerializableExtra("LIST");
|
||||
// for (int i = 0; i < results.size(); i++) {
|
||||
// Logger.d(results.get(i));
|
||||
// }
|
||||
resultListAdapter = new ResultListAdapter(ConstantUtils.testData, this);
|
||||
recyclerView.setAdapter(resultListAdapter);
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initToolBar() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPointerCaptureChanged(boolean hasCapture) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
package com.example.ninefourone.nutritionmaster.utils;
|
||||
|
||||
import com.example.ninefourone.nutritionmaster.bean.ClassifyResult;
|
||||
import com.example.ninefourone.nutritionmaster.bean.MyUser;
|
||||
import com.orhanobut.logger.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
|
||||
/**
|
||||
@@ -70,6 +73,29 @@ public class CalculateUtils {
|
||||
public static int getWeek() {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
// Logger.d( calendar.get(Calendar.DAY_OF_WEEK));
|
||||
return calendar.get(Calendar.DAY_OF_WEEK)-1;
|
||||
return calendar.get(Calendar.DAY_OF_WEEK) - 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算每个食物吃多少
|
||||
* @param classifyResultArrayList
|
||||
* @param user
|
||||
* @return
|
||||
*/
|
||||
|
||||
public static ArrayList<ClassifyResult> getDishQuantity(
|
||||
ArrayList<ClassifyResult> classifyResultArrayList, MyUser user) {
|
||||
double calorieSum = 0;
|
||||
double[] calories = new double[classifyResultArrayList.size()];
|
||||
double[] quantitys = new double[classifyResultArrayList.size()];
|
||||
float baseQuantity = 600f;
|
||||
for (int i = 0; i < classifyResultArrayList.size(); i++) {
|
||||
calorieSum += classifyResultArrayList.get(i).getCalorie();
|
||||
calories[i] = classifyResultArrayList.get(i).getCalorie();
|
||||
}
|
||||
for (int i = 0; i < classifyResultArrayList.size(); i++) {
|
||||
classifyResultArrayList.get(i).setQuantity(calories[i] / calorieSum * baseQuantity);
|
||||
}
|
||||
return classifyResultArrayList;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.example.ninefourone.nutritionmaster.utils;
|
||||
|
||||
import com.example.ninefourone.nutritionmaster.bean.ClassifyResult;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
@@ -275,4 +277,15 @@ public class ConstantUtils {
|
||||
|
||||
public static String BD_DISH_URL = "https://aip.baidubce.com/rest/2.0/image-classify/v2/dish";
|
||||
|
||||
public static ArrayList<ClassifyResult> testData = new ArrayList<>();
|
||||
|
||||
static {
|
||||
for (int i = 0; i < 7; i++) {
|
||||
ClassifyResult classifyResult = new ClassifyResult();
|
||||
classifyResult.setName("酱肉丝" + i);
|
||||
classifyResult.setProbability(0.5 + i);
|
||||
classifyResult.setCalorie(274 + i * 10);
|
||||
testData.add(classifyResult);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,9 @@ package com.example.ninefourone.nutritionmaster.utils;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.example.ninefourone.nutritionmaster.NutritionMaster;
|
||||
import com.orhanobut.logger.Logger;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by ScorpioMiku on 2018/8/26.
|
||||
@@ -13,4 +16,6 @@ public class MessageUtils {
|
||||
public static void MakeToast(String message) {
|
||||
Toast.makeText(NutritionMaster.getInstance(), message, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -10,27 +10,32 @@
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="35dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_margin="10dp"
|
||||
android:layout_weight="0.5"
|
||||
android:gravity="center"
|
||||
android:text="信息清单"
|
||||
android:textColor="#fff"
|
||||
android:textSize="18sp" />
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="335dp">
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="3">
|
||||
|
||||
</android.support.v7.widget.RecyclerView>
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_weight="0.9"
|
||||
app:cardCornerRadius="15dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="100dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#50b67c"
|
||||
android:orientation="horizontal">
|
||||
|
||||
@@ -64,6 +69,7 @@
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/calorie"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="7dp"
|
||||
@@ -91,11 +97,12 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:text="大卡"
|
||||
android:text="克"
|
||||
android:textColor="#fff" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/suger"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="7dp"
|
||||
@@ -110,6 +117,8 @@
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_weight="0.005"
|
||||
android:alpha="0.7"
|
||||
android:background="#d7d6d6" />
|
||||
@@ -139,11 +148,12 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:text="大卡"
|
||||
android:text="克"
|
||||
android:textColor="#fff" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/fat"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="7dp"
|
||||
@@ -163,23 +173,24 @@
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="碳水化合物"
|
||||
android:text="蛋白质"
|
||||
android:textColor="#fff" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/sugar_tag"
|
||||
android:id="@+id/protein_tag"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:text="大卡"
|
||||
android:text="克"
|
||||
android:textColor="#fff" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/protein"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="7dp"
|
||||
android:layout_toLeftOf="@+id/sugar_tag"
|
||||
android:layout_toLeftOf="@+id/protein_tag"
|
||||
android:text="大卡"
|
||||
android:textColor="#fff" />
|
||||
|
||||
@@ -191,11 +202,13 @@
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="0.8"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<Button
|
||||
android:id="@+id/ok_button"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="50dp"
|
||||
android:background="#76c47e"
|
||||
|
||||
@@ -3,13 +3,14 @@
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="70dp"
|
||||
android:layout_height="80dp"
|
||||
android:layout_margin="5dp"
|
||||
app:cardCornerRadius="10dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#41da98"
|
||||
android:background="#40b985"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
@@ -19,23 +20,41 @@
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<com.github.siyamed.shapeimageview.CircularImageView
|
||||
<android.support.v7.widget.CardView
|
||||
android:alpha="0.8"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="60dp"
|
||||
android:scaleType="centerCrop"
|
||||
tools:src="@drawable/food_test" />
|
||||
app:cardCornerRadius="30dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/image"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="centerCrop"
|
||||
tools:src="@drawable/food_test" />
|
||||
</android.support.v7.widget.CardView>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingLeft="15dp"
|
||||
tools:text="麻婆豆腐"
|
||||
android:gravity="center"
|
||||
android:textColor="#fff"/>
|
||||
android:paddingLeft="15dp"
|
||||
android:textColor="#fff"
|
||||
tools:text="麻婆豆腐" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/picker"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="15dp"
|
||||
android:layout_marginRight="15dp"
|
||||
android:clipToPadding="false">
|
||||
|
||||
</android.support.v7.widget.RecyclerView>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
7
app/src/main/res/layout/picker_item.xml
Normal file
7
app/src/main/res/layout/picker_item.xml
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/picker_item"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="13dp"
|
||||
android:textSize="15sp" />
|
||||
Reference in New Issue
Block a user