我与颜色和图像有关,
每种产品都有颜色,每种颜色都有图像和图标
这是来自数据库的响应:
@Override
public void onBindViewHolder(final SimpleViewHolder viewHolder, final int position) {
int rowPos = viewHolder.getAdapterPosition ();
final String item = String.valueOf (operatorlist.get (position));
String[] strArray = new String[]{item};
System.out.println (strArray);
viewHolder.tvEmail.setText (strArray[0]);
// viewHolder.tvName.setText (strArray[1]);
// String[] strArray1=new String[]{String.valueOf (strArray)};;
// for (int i=0;i<strArray.length;i++){
// strArray1=strArray;
//
//
// // viewHolder.tvEmail.setText (strArray1[1].get());
//
// }
// System.out.println (strArray[1]); //prints "name"
// viewHolder.tvName.setText ((strArray[3]));
// viewHolder.tvEmail.setText (strArray[0]);
// viewHolder.txtRank.setText (strArray[1]);
viewHolder.swipeLayout.setShowMode (SwipeLayout.ShowMode.PullOut);
// Drag From Left
viewHolder.swipeLayout.addDrag (SwipeLayout.DragEdge.Left, viewHolder.swipeLayout.findViewById (R.id.bottom_wrapper1));
// Drag From Right
viewHolder.swipeLayout.addDrag (SwipeLayout.DragEdge.Right, viewHolder.swipeLayout.findViewById (R.id.bottom_wrapper));
// Handling different events when swiping
viewHolder.swipeLayout.addSwipeListener (new SwipeLayout.SwipeListener ( ) {
@Override
public void onClose(SwipeLayout layout) {
//when the SurfaceView totally cover the BottomView.
}
@Override
public void onUpdate(SwipeLayout layout, int leftOffset, int topOffset) {
//you are swiping.
}
@Override
public void onStartOpen(SwipeLayout layout) {
}
@Override
public void onOpen(SwipeLayout layout) {
//when the BottomView totally show.
}
@Override
public void onStartClose(SwipeLayout layout) {
}
@Override
public void onHandRelease(SwipeLayout layout, float xvel, float yvel) {
//when user's hand released.
}
});
如何创建HTML表单来添加此信息?
,以及如何发布使用控制器按颜色分组的这些图像?
答案 0 :(得分:0)
<input type="text" name="id"/>
<input type="text" name="name"/>
<input type="text" name="colors[id][]"/>
<input type="text" name="colors[stocks_id][]"/>
<input type="text" name="colors[color_name][]"/>
<input type="text" name="colors[icon][]"/>
<input type="text" name="colors[images][$n+1][]"/>
在控制器中
$colors= [];
$index= 0;
// colors[id] = [0=>1, 1=>2];
// colors[stocks_id] = [0=>234, 1=>289];
foreach($request['colors'] as $key => $color){
if(!isset($colors[$index])){
$colors[] = [];
}
if(!isset($colors[$index][$key])){
$colors[$index][$key] = $color[$index];
}
$index++;
}
应该有一个循环来迭代颜色,并且有另一个循环来迭代关于该颜色的所有图像。