@ -0,0 +1,84 @@
|
||||
package com.startsmake.llrisetabbardemo.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.Uri;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.startsmake.llrisetabbardemo.R;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ImageAdapter extends BaseAdapter {
|
||||
|
||||
private Context context;
|
||||
private List<Uri> imageUris;
|
||||
private static final int MAX_IMAGES = 9;
|
||||
|
||||
public ImageAdapter(Context context, List<Uri> imageUris) {
|
||||
this.context = context;
|
||||
this.imageUris = imageUris;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return Math.min(imageUris.size() + 1, MAX_IMAGES);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
if (position < imageUris.size()) {
|
||||
return imageUris.get(position);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
ViewHolder holder;
|
||||
if (convertView == null) {
|
||||
convertView = LayoutInflater.from(context).inflate(R.layout.item_image, parent, false);
|
||||
holder = new ViewHolder();
|
||||
holder.imageView = convertView.findViewById(R.id.imageView);
|
||||
holder.deleteButton = convertView.findViewById(R.id.btnDelete);
|
||||
convertView.setTag(holder);
|
||||
} else {
|
||||
holder = (ViewHolder) convertView.getTag();
|
||||
}
|
||||
|
||||
if (position < imageUris.size()) {
|
||||
// 显示已选择的图片
|
||||
Uri imageUri = imageUris.get(position);
|
||||
Glide.with(context)
|
||||
.load(imageUri)
|
||||
.placeholder(android.R.drawable.ic_menu_gallery) // 使用系统图标作为占位符
|
||||
.into(holder.imageView);
|
||||
|
||||
holder.deleteButton.setVisibility(View.VISIBLE);
|
||||
holder.deleteButton.setOnClickListener(v -> {
|
||||
imageUris.remove(position);
|
||||
notifyDataSetChanged();
|
||||
});
|
||||
} else {
|
||||
// 显示添加按钮
|
||||
holder.imageView.setImageResource(android.R.drawable.ic_input_add); // 使用系统图标
|
||||
holder.deleteButton.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
return convertView;
|
||||
}
|
||||
|
||||
static class ViewHolder {
|
||||
ImageView imageView;
|
||||
ImageView deleteButton;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,204 @@
|
||||
package com.startsmake.llrisetabbardemo.fragment;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.GridView;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.startsmake.llrisetabbardemo.R;
|
||||
import com.startsmake.llrisetabbardemo.activity.MainActivity;
|
||||
import com.startsmake.llrisetabbardemo.adapter.ImageAdapter;
|
||||
|
||||
import com.startsmake.llrisetabbardemo.model.Item;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class PublishFragment extends Fragment {
|
||||
|
||||
private static final int REQUEST_CODE_PICK_IMAGES = 1001;
|
||||
private static final int MAX_IMAGE_COUNT = 9;
|
||||
|
||||
private EditText etTitle, etDescription, etPrice, etContact;
|
||||
private Spinner spinnerCategory, spinnerLocation;
|
||||
private GridView gridViewImages;
|
||||
private Button btnPublish;
|
||||
|
||||
private ImageAdapter imageAdapter;
|
||||
private List<Uri> selectedImages = new ArrayList<>();
|
||||
|
||||
public PublishFragment() {
|
||||
// Required empty public constructor
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
return inflater.inflate(R.layout.fragment_publish, container, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
|
||||
initViews(view);
|
||||
setupSpinners();
|
||||
setupImageGrid();
|
||||
setupClickListeners();
|
||||
}
|
||||
|
||||
private void initViews(View view) {
|
||||
etTitle = view.findViewById(R.id.etTitle);
|
||||
etDescription = view.findViewById(R.id.etDescription);
|
||||
etPrice = view.findViewById(R.id.etPrice);
|
||||
etContact = view.findViewById(R.id.etContact);
|
||||
spinnerCategory = view.findViewById(R.id.spinnerCategory);
|
||||
spinnerLocation = view.findViewById(R.id.spinnerLocation);
|
||||
gridViewImages = view.findViewById(R.id.gridViewImages);
|
||||
btnPublish = view.findViewById(R.id.btnPublish);
|
||||
}
|
||||
|
||||
private void setupSpinners() {
|
||||
String[] categories = {"数码产品", "服装鞋帽", "家居日用", "图书文具", "美妆个护", "运动户外", "其他"};
|
||||
ArrayAdapter<String> categoryAdapter = new ArrayAdapter<>(
|
||||
requireContext(), android.R.layout.simple_spinner_item, categories);
|
||||
categoryAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
spinnerCategory.setAdapter(categoryAdapter);
|
||||
|
||||
String[] locations = {"北京", "上海", "广州", "深圳", "杭州", "成都", "武汉", "其他"};
|
||||
ArrayAdapter<String> locationAdapter = new ArrayAdapter<>(
|
||||
requireContext(), android.R.layout.simple_spinner_item, locations);
|
||||
locationAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
spinnerLocation.setAdapter(locationAdapter);
|
||||
}
|
||||
|
||||
private void setupImageGrid() {
|
||||
imageAdapter = new ImageAdapter(requireContext(), selectedImages);
|
||||
gridViewImages.setAdapter(imageAdapter);
|
||||
}
|
||||
|
||||
private void setupClickListeners() {
|
||||
gridViewImages.setOnItemClickListener((parent, view, position, id) -> {
|
||||
if (position == selectedImages.size() && selectedImages.size() < MAX_IMAGE_COUNT) {
|
||||
openImagePicker();
|
||||
}
|
||||
});
|
||||
|
||||
btnPublish.setOnClickListener(v -> publishItem());
|
||||
}
|
||||
|
||||
private void openImagePicker() {
|
||||
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
|
||||
intent.setType("image/*");
|
||||
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
|
||||
startActivityForResult(Intent.createChooser(intent, "选择图片"), REQUEST_CODE_PICK_IMAGES);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
|
||||
if (requestCode == REQUEST_CODE_PICK_IMAGES && resultCode == Activity.RESULT_OK) {
|
||||
if (data != null) {
|
||||
if (data.getClipData() != null) {
|
||||
int count = Math.min(data.getClipData().getItemCount(),
|
||||
MAX_IMAGE_COUNT - selectedImages.size());
|
||||
for (int i = 0; i < count; i++) {
|
||||
Uri imageUri = data.getClipData().getItemAt(i).getUri();
|
||||
selectedImages.add(imageUri);
|
||||
}
|
||||
} else if (data.getData() != null) {
|
||||
selectedImages.add(data.getData());
|
||||
}
|
||||
imageAdapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void publishItem() {
|
||||
String title = etTitle.getText().toString().trim();
|
||||
String description = etDescription.getText().toString().trim();
|
||||
String priceStr = etPrice.getText().toString().trim();
|
||||
String contact = etContact.getText().toString().trim();
|
||||
|
||||
if (title.isEmpty()) {
|
||||
Toast.makeText(requireContext(), "请输入商品标题", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
if (description.isEmpty()) {
|
||||
Toast.makeText(requireContext(), "请输入商品描述", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
if (priceStr.isEmpty()) {
|
||||
Toast.makeText(requireContext(), "请输入商品价格", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
if (contact.isEmpty()) {
|
||||
Toast.makeText(requireContext(), "请输入联系方式", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
if (selectedImages.isEmpty()) {
|
||||
Toast.makeText(requireContext(), "请至少上传一张图片", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
double price = Double.parseDouble(priceStr);
|
||||
if (price <= 0) {
|
||||
Toast.makeText(requireContext(), "价格必须大于0", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
// 创建物品对象
|
||||
Item item = new Item();
|
||||
item.setTitle(title);
|
||||
item.setDescription(description);
|
||||
item.setPrice(price);
|
||||
item.setContact(contact);
|
||||
item.setCategory(spinnerCategory.getSelectedItem().toString());
|
||||
item.setLocation(spinnerLocation.getSelectedItem().toString());
|
||||
item.setPublishTime(System.currentTimeMillis());
|
||||
item.setUserId("user_" + System.currentTimeMillis());
|
||||
|
||||
// 发布成功
|
||||
Toast.makeText(requireContext(), "发布成功!", Toast.LENGTH_SHORT).show();
|
||||
clearForm();
|
||||
|
||||
// 发布完成后自动返回首页
|
||||
if (getActivity() instanceof MainActivity) {
|
||||
((MainActivity) getActivity()).switchToHomeFragment();
|
||||
}
|
||||
|
||||
} catch (NumberFormatException e) {
|
||||
Toast.makeText(requireContext(), "请输入有效的价格", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
private void clearForm() {
|
||||
etTitle.setText("");
|
||||
etDescription.setText("");
|
||||
etPrice.setText("");
|
||||
etContact.setText("");
|
||||
selectedImages.clear();
|
||||
imageAdapter.notifyDataSetChanged();
|
||||
spinnerCategory.setSelection(0);
|
||||
spinnerLocation.setSelection(0);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,53 @@
|
||||
package com.startsmake.llrisetabbardemo.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Item implements Serializable {
|
||||
private String id;
|
||||
private String title;
|
||||
private String description;
|
||||
private double price;
|
||||
private List<String> imageUrls;
|
||||
private String category;
|
||||
private String location;
|
||||
private String contact;
|
||||
private long publishTime;
|
||||
private String userId;
|
||||
|
||||
public Item() {
|
||||
imageUrls = new ArrayList<>();
|
||||
}
|
||||
|
||||
// Getters and Setters
|
||||
public String getId() { return id; }
|
||||
public void setId(String id) { this.id = id; }
|
||||
|
||||
public String getTitle() { return title; }
|
||||
public void setTitle(String title) { this.title = title; }
|
||||
|
||||
public String getDescription() { return description; }
|
||||
public void setDescription(String description) { this.description = description; }
|
||||
|
||||
public double getPrice() { return price; }
|
||||
public void setPrice(double price) { this.price = price; }
|
||||
|
||||
public List<String> getImageUrls() { return imageUrls; }
|
||||
public void setImageUrls(List<String> imageUrls) { this.imageUrls = imageUrls; }
|
||||
|
||||
public String getCategory() { return category; }
|
||||
public void setCategory(String category) { this.category = category; }
|
||||
|
||||
public String getLocation() { return location; }
|
||||
public void setLocation(String location) { this.location = location; }
|
||||
|
||||
public String getContact() { return contact; }
|
||||
public void setContact(String contact) { this.contact = contact; }
|
||||
|
||||
public long getPublishTime() { return publishTime; }
|
||||
public void setPublishTime(long publishTime) { this.publishTime = publishTime; }
|
||||
|
||||
public String getUserId() { return userId; }
|
||||
public void setUserId(String userId) { this.userId = userId; }
|
||||
}
|
||||
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="#99000000" />
|
||||
<corners android:radius="12dp" />
|
||||
</shape>
|
||||
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@android:color/white" />
|
||||
<corners android:radius="8dp" />
|
||||
<stroke
|
||||
android:width="1dp"
|
||||
android:color="#e0e0e0" />
|
||||
</shape>
|
||||
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="#f0f0f0" />
|
||||
<corners android:radius="4dp" />
|
||||
<stroke
|
||||
android:width="1dp"
|
||||
android:color="#e0e0e0" />
|
||||
</shape>
|
||||
@ -0,0 +1,6 @@
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
|
||||
<!-- 设置圆角半径 -->
|
||||
<corners android:radius="20dp"/>
|
||||
<!-- 背景颜色 -->
|
||||
<solid android:color="@android:color/white"/>
|
||||
</shape>
|
||||
@ -1,14 +1,30 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="首页"/>
|
||||
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#fffaf0" android:orientation="vertical">
|
||||
<!-- 顶部搜索栏区域 -->
|
||||
<LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#FFDD59" android:orientation="vertical" android:padding="10dp">
|
||||
<!-- 搜索框 -->
|
||||
<LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="8dp" android:alpha="0.8" android:background="@drawable/rounded_background1" android:gravity="center_vertical" android:orientation="horizontal" android:padding="8dp">
|
||||
<!-- 搜索图标 -->
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:alpha="1" android:text="🔍" android:textSize="16sp"/>
|
||||
<!-- 搜索输入框 -->
|
||||
<EditText android:id="@+id/search_edit_text" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:alpha="1" android:background="@null" android:focusable="true" android:focusableInTouchMode="true" android:hint="搜索教材、数码、生活用品..." android:imeOptions="actionSearch" android:inputType="text" android:maxLines="1" android:paddingStart="8dp" android:paddingEnd="8dp" android:singleLine="true" android:textColor="#333333" android:textColorHint="#999999" android:textSize="14sp"/>
|
||||
<ImageButton android:id="@+id/camera_button" android:layout_width="23dp" android:layout_height="24dp" android:layout_marginStart="4dp" android:background="?android:attr/selectableItemBackgroundBorderless" android:padding="0.5dp" android:scaleType="centerInside" android:src="@android:drawable/ic_menu_camera" android:contentDescription="拍照搜索"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
<!-- 导航标签区域 -->
|
||||
<HorizontalScrollView android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="65dp" android:background="@android:color/white" android:paddingVertical="8dp">
|
||||
<LinearLayout android:id="@+id/tab_container" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal">
|
||||
<!-- 关注标签 -->
|
||||
<RadioButton android:id="@+id/tab_follow" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingStart="20dp" android:paddingEnd="20dp" android:paddingTop="10dp" android:paddingBottom="10dp" android:text="关注" android:button="@null" android:textColor="#ff6b35" android:textSize="14sp" android:textStyle="bold" android:background="?attr/selectableItemBackground" android:clickable="true" android:focusable="true"/>
|
||||
<!-- 推荐标签 -->
|
||||
<TextView android:id="@+id/tab_recommend" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingStart="20dp" android:paddingEnd="20dp" android:paddingTop="10dp" android:paddingBottom="10dp" android:text="推荐" android:textColor="#666666" android:textSize="14sp" android:background="?attr/selectableItemBackground" android:clickable="true" android:focusable="true"/>
|
||||
<!-- 新发布标签 -->
|
||||
<TextView android:id="@+id/tab_new" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingStart="20dp" android:paddingEnd="20dp" android:paddingTop="10dp" android:paddingBottom="10dp" android:text="新发布" android:textColor="#666666" android:textSize="14sp" android:background="?attr/selectableItemBackground" android:clickable="true" android:focusable="true"/>
|
||||
<!-- 学习资料标签 -->
|
||||
<TextView android:id="@+id/tab_study" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingStart="20dp" android:paddingEnd="20dp" android:paddingTop="10dp" android:paddingBottom="10dp" android:text="学习资料" android:textColor="#666666" android:textSize="14sp" android:background="?attr/selectableItemBackground" android:clickable="true" android:focusable="true"/>
|
||||
<!-- 生活用品标签 -->
|
||||
<TextView android:id="@+id/tab_living" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingStart="20dp" android:paddingEnd="20dp" android:paddingTop="10dp" android:paddingBottom="10dp" android:text="生活用品" android:textColor="#666666" android:textSize="14sp" android:background="?attr/selectableItemBackground" android:clickable="true" android:focusable="true"/>
|
||||
</LinearLayout>
|
||||
</HorizontalScrollView>
|
||||
<!-- 首页文字 -->
|
||||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center"/>
|
||||
</FrameLayout>
|
||||
@ -0,0 +1,148 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="16dp"
|
||||
android:background="#f5f5f5">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<!-- 图片上传区域 -->
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="上传图片"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginBottom="8dp" />
|
||||
|
||||
<GridView
|
||||
android:id="@+id/gridViewImages"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:numColumns="3"
|
||||
android:verticalSpacing="8dp"
|
||||
android:horizontalSpacing="8dp"
|
||||
android:stretchMode="columnWidth"
|
||||
android:background="@drawable/bg_edittext"
|
||||
android:padding="8dp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="最多可上传9张图片"
|
||||
android:textSize="12sp"
|
||||
android:textColor="#666"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_marginBottom="16dp" />
|
||||
|
||||
<!-- 商品信息区域 -->
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="商品信息"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginBottom="8dp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/etTitle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="商品标题"
|
||||
android:maxLines="1"
|
||||
android:background="@drawable/bg_edittext"
|
||||
android:padding="12dp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/etDescription"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="120dp"
|
||||
android:hint="商品描述"
|
||||
android:gravity="top"
|
||||
android:maxLines="5"
|
||||
android:background="@drawable/bg_edittext"
|
||||
android:padding="12dp"
|
||||
android:layout_marginTop="8dp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginTop="8dp">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/etPrice"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:hint="价格"
|
||||
android:inputType="numberDecimal"
|
||||
android:background="@drawable/bg_edittext"
|
||||
android:padding="12dp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="元"
|
||||
android:textSize="14sp"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingEnd="8dp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- 分类和位置 -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginTop="8dp">
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/spinnerCategory"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/bg_edittext"
|
||||
android:padding="8dp" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/spinnerLocation"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginStart="8dp"
|
||||
android:background="@drawable/bg_edittext"
|
||||
android:padding="8dp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- 联系方式 -->
|
||||
<EditText
|
||||
android:id="@+id/etContact"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="联系方式(微信/电话)"
|
||||
android:maxLines="1"
|
||||
android:background="@drawable/bg_edittext"
|
||||
android:padding="12dp"
|
||||
android:layout_marginTop="8dp" />
|
||||
|
||||
<!-- 发布按钮 -->
|
||||
<Button
|
||||
android:id="@+id/btnPublish"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:text="发布商品"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold"
|
||||
android:background="@drawable/bg_button_primary"
|
||||
android:textColor="@android:color/white"
|
||||
android:layout_marginTop="24dp" />
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="100dp"
|
||||
android:padding="2dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="centerCrop"
|
||||
android:background="@drawable/bg_image_border" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/btnDelete"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:src="@android:drawable/ic_delete"
|
||||
android:background="@drawable/bg_delete_button" />
|
||||
|
||||
</RelativeLayout>
|
||||
Loading…
Reference in new issue