欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Android?Studio實(shí)現(xiàn)購(gòu)買售賣系統(tǒng)

 更新時(shí)間:2022年02月10日 12:36:36   作者:再來(lái)五串腰子  
這篇文章主要為大家詳細(xì)介紹了Android?Studio實(shí)現(xiàn)購(gòu)買售賣系統(tǒng),文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

本文實(shí)例為大家分享了Android Studio實(shí)現(xiàn)購(gòu)買售賣系統(tǒng)的具體代碼,供大家參考,具體內(nèi)容如下

本項(xiàng)目基于安卓系統(tǒng)開發(fā)的界面設(shè)計(jì),包括登錄,主頁(yè)面,展示頁(yè)面,購(gòu)買頁(yè)面等六個(gè)頁(yè)面

ShopActivity

package com.example.tryfirst;
?
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.TextView;
?
public class ShopActivity extends AppCompatActivity implements View.OnClickListener{
?
? ? private ItemInfo itemInfo0;
? ? private ItemInfo itemInfo1;
? ? private ItemInfo itemInfo2;
? ? private ItemInfo itemInfo3;
? ? @Override
? ? protected void onCreate(Bundle savedInstanceState) {
? ? ? ? super.onCreate(savedInstanceState);
? ? ? ? setContentView(R.layout.activity_shop);
? ? ? ? itemInfo0 = new ItemInfo("空軍一號(hào)");
? ? ? ? itemInfo1 = new ItemInfo("李寧足球鞋");
? ? ? ? itemInfo2 = new ItemInfo("匹克太極籃球鞋");
? ? ? ? itemInfo3 = new ItemInfo("林丹羽毛球鞋");
? ? ? ? findViewById(R.id.btn_0).setOnClickListener(this);
? ? ? ? findViewById(R.id.btn_1).setOnClickListener(this);
? ? ? ? findViewById(R.id.btn_2).setOnClickListener(this);
? ? ? ? findViewById(R.id.btn_3).setOnClickListener(this);
? ? }
? ? public void onClick(View v){
? ? ? ? Intent intent;
? ? ? ? switch (v.getId()) {
? ? ? ? ? ? case R.id.btn_0:
? ? ? ? ? ? ? ? intent = new Intent();
? ? ? ? ? ? ? ? intent.putExtra("shoe",itemInfo0);
? ? ? ? ? ? ? ? setResult(1,intent);
? ? ? ? ? ? ? ? finish();
? ? ? ? ? ? ? ? break;
? ? ? ? ? ? case R.id.btn_1:
? ? ? ? ? ? ? ? intent = new Intent();
? ? ? ? ? ? ? ? intent.putExtra("shoe",itemInfo1);
? ? ? ? ? ? ? ? setResult(1,intent);
? ? ? ? ? ? ? ? finish();
? ? ? ? ? ? ? ? break;
? ? ? ? ? ? case R.id.btn_2:
? ? ? ? ? ? ? ? intent = new Intent();
? ? ? ? ? ? ? ? intent.putExtra("shoe",itemInfo0);
? ? ? ? ? ? ? ? setResult(1,intent);
? ? ? ? ? ? ? ? finish();
? ? ? ? ? ? ? ? break;
? ? ? ? ? ? case R.id.btn_3:
? ? ? ? ? ? ? ? intent = new Intent();
? ? ? ? ? ? ? ? intent.putExtra("shoe",itemInfo0);
? ? ? ? ? ? ? ? setResult(1,intent);
? ? ? ? ? ? ? ? finish();
? ? ? ? ? ? ? ? break;
? ? ? ? }
? ? }
}

ShowActivity

package com.example.tryfirst;
?
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.TextView;
?
public class ShowActivity extends AppCompatActivity {
?
? ? private TextView tv_name;
? ? private TextView tv_password;
? ? private TextView shoe;
? ? @Override
? ? protected void onCreate(Bundle savedInstanceState) {
? ? ? ? super.onCreate(savedInstanceState);
? ? ? ? setContentView(R.layout.activity_show);
? ? ? ? Intent intent = getIntent();
? ? ? ? String name = intent.getStringExtra("name");
? ? ? ? String password = intent.getStringExtra("password");
? ? ? ? tv_name = (TextView) findViewById(R.id.tv_name);
? ? ? ? tv_password = (TextView) findViewById(R.id.tv_password);
? ? ? ? tv_name.setText("用戶名為: " + name);
? ? ? ? tv_password.setText("密碼為: " + password);
? ? ? ? shoe = (TextView) findViewById(R.id.tv_food_progress);
? ? }
? ? public void click0(View view){
? ? ? ? Intent intent = new Intent(this, FriendActivity.class);
? ? ? ? startActivity(intent);
? ? }
? ? public void click1(View view){
? ? ? ? Intent intent = new Intent(this,ShopActivity.class);
? ? ? ? startActivityForResult(intent,1);
? ? }
? ? public void click2(View view){
? ? ? ? Intent intent = new Intent(this,ListActivity.class);
? ? ? ? startActivity(intent);
? ? }
? ? @Override
? ? protected void onActivityResult(int requestCode,
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? int resultCode,Intent data){
? ? ? ? super.onActivityResult(requestCode,resultCode,data);
? ? ? ? if(data !=null){
? ? ? ? ? ? if(requestCode==1){
? ? ? ? ? ? ? ? if(resultCode==1){
? ? ? ? ? ? ? ? ? ? ItemInfo info =
? ? ? ? ? ? ? ? ? ? ? ? ? ? (ItemInfo) data.getSerializableExtra("food");
? ? ? ? ? ? ? ? ? ? updateProgress(info);
? ? ? ? ? ? ? ? }
? ? ? ? ? ? }
? ? ? ? }
? ? }
? ? private void updateProgress(ItemInfo info){shoe.setText(info.getName());
? ? }
}

ListActivity

package com.example.tryfirst;
?
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
public class ListActivity extends AppCompatActivity {
? ? private ListView mListView;
? ? private String[] names = {"郭艾倫aj34"};
? ? private int[] herd = {R.drawable.l};
? ? @Override
? ? protected void onCreate(Bundle savedInstanceState) {
? ? ? ? super.onCreate(savedInstanceState);
? ? ? ? setContentView(R.layout.activity_list);
? ? ? ? mListView = (ListView) findViewById(R.id.lv);
? ? ? ? MyBaseAdapter myAdapter = new MyBaseAdapter();
? ? ? ? mListView.setAdapter(myAdapter);
? ? }
? ? class MyBaseAdapter extends BaseAdapter {
? ? ? ? @Override
? ? ? ? public int getCount() {
? ? ? ? ? ? return names.length;
? ? ? ? }
?
? ? ? ? @Override
? ? ? ? public Object getItem(int position) {
? ? ? ? ? ? return names[position];
? ? ? ? }
?
? ? ? ? @Override
? ? ? ? public long getItemId(int position) {
? ? ? ? ? ? return position;
? ? ? ? }
?
? ? ? ? @Override
? ? ? ? public View getView(int position, View convertView, ViewGroup parent) {
? ? ? ? ? ? //將list.xml文件找出來(lái)轉(zhuǎn)化為View對(duì)象
? ? ? ? ? ? View view = View.inflate(ListActivity.this,R.layout.list,null);
? ? ? ? ? ? TextView mTextView = (TextView) view.findViewById(R.id.tv);
? ? ? ? ? ? mTextView.setText(names[position]);
? ? ? ? ? ? ImageView imageView = (ImageView) view.findViewById(R.id.imge);
? ? ? ? ? ? imageView.setBackgroundResource(herd[position]);
? ? ? ? ? ? return view;
? ? ? ? }
? ? }
}

Activity_Shop .xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
? ? xmlns:android="http://schemas.android.com/apk/res/android"
? ? xmlns:tools="http://schemas.android.com/tools"
? ? android:layout_width="match_parent"
? ? android:layout_height="match_parent"
? ? android:background="@drawable/back"
? ? android:orientation="vertical"
? ? tools:context=".ShopActivity">
? ? <LinearLayout
? ? ? ? android:layout_width="match_parent"
? ? ? ? android:layout_height="wrap_content"
? ? ? ? android:background="#307f7f7f"
? ? ? ? android:gravity="center_vertical"
? ? ? ? android:orientation="horizontal"
? ? ? ? android:padding="5dp">
? ? ? ? <ImageView
? ? ? ? ? ? android:layout_width="80dp"
? ? ? ? ? ? android:layout_height="200dp"
? ? ? ? ? ? android:background="@drawable/lin"
? ? ? ? ? ? android:layout_weight="1"/>
? ? ? ? <TextView
? ? ? ? ? ? android:layout_width="0dp"
? ? ? ? ? ? android:layout_height="wrap_content"
? ? ? ? ? ? android:layout_marginLeft="20dp"
? ? ? ? ? ? android:text="空軍一號(hào)"
? ? ? ? ? ? android:layout_weight="3"
? ? ? ? ? ? android:textSize="35sp" />
? ? ? ? <Button
? ? ? ? ? ? android:layout_width="0dp"
? ? ? ? ? ? android:layout_height="wrap_content"
? ? ? ? ? ? android:id="@+id/btn_8"
? ? ? ? ? ? android:text="加入購(gòu)物車"
? ? ? ? ? ? android:layout_weight="1"/>
? ? ? ? <Button
? ? ? ? ? ? android:layout_width="0dp"
? ? ? ? ? ? android:layout_height="wrap_content"
? ? ? ? ? ? android:layout_weight="1"
? ? ? ? ? ? android:id="@+id/btn_0"
? ? ? ? ? ? android:text="購(gòu)買"/>
? ? </LinearLayout>
? ? <LinearLayout
? ? ? ? android:layout_width="match_parent"
? ? ? ? android:layout_height="wrap_content">
? ? ? ? <ImageView
? ? ? ? ? ? android:layout_width="80dp"
? ? ? ? ? ? android:layout_height="200dp"
? ? ? ? ? ? android:background="@drawable/longtuos"
? ? ? ? ? ? android:layout_weight="1"/>
? ? ? ? <TextView
? ? ? ? ? ? android:layout_width="0dp"
? ? ? ? ? ? android:layout_height="wrap_content"
? ? ? ? ? ? android:layout_marginLeft="20dp"
? ? ? ? ? ? android:text="李寧足球鞋"
? ? ? ? ? ? android:textSize="35sp"
? ? ? ? ? ? android:layout_weight="3"/>
? ? ? ? <Button
? ? ? ? ? ? android:layout_width="0dp"
? ? ? ? ? ? android:layout_height="wrap_content"
? ? ? ? ? ? android:id="@+id/btn_9"
? ? ? ? ? ? android:text="加入購(gòu)物車"
? ? ? ? ? ? android:layout_weight="1"/>
? ? ? ? <Button
? ? ? ? ? ? android:layout_width="0dp"
? ? ? ? ? ? android:layout_height="wrap_content"
? ? ? ? ? ? android:id="@+id/btn_1"
? ? ? ? ? ? android:text="購(gòu)買"
? ? ? ? ? ? android:layout_weight="1"/>
? ? </LinearLayout>
? ? <LinearLayout
? ? ? ? android:layout_width="match_parent"
? ? ? ? android:layout_height="wrap_content">
? ? ? ? <ImageView
? ? ? ? ? ? android:layout_width="80dp"
? ? ? ? ? ? android:layout_height="200dp"
? ? ? ? ? ? android:background="@drawable/longtuos"
? ? ? ? ? ? android:layout_weight="1"/>
? ? ? ? <TextView
? ? ? ? ? ? android:layout_width="0dp"
? ? ? ? ? ? android:layout_height="wrap_content"
? ? ? ? ? ? android:layout_marginLeft="20dp"
? ? ? ? ? ? android:text="匹克太極籃球鞋"
? ? ? ? ? ? android:textSize="35sp"
? ? ? ? ? ? android:layout_weight="3"/>
? ? ? ? <Button
? ? ? ? ? ? android:layout_width="0dp"
? ? ? ? ? ? android:layout_height="wrap_content"
? ? ? ? ? ? android:id="@+id/btn_6"
? ? ? ? ? ? android:text="加入購(gòu)物車"
? ? ? ? ? ? android:layout_weight="1"/>
? ? ? ? <Button
? ? ? ? ? ? android:layout_width="0dp"
? ? ? ? ? ? android:layout_height="wrap_content"
? ? ? ? ? ? android:id="@+id/btn_2"
? ? ? ? ? ? android:text="購(gòu)買"
? ? ? ? ? ? android:layout_weight="1"/>
? ? </LinearLayout>
? ? <LinearLayout
? ? ? ? android:layout_width="match_parent"
? ? ? ? android:layout_height="wrap_content">
? ? ? ? <ImageView
? ? ? ? ? ? android:layout_width="80dp"
? ? ? ? ? ? android:layout_height="200dp"
? ? ? ? ? ? android:background="@drawable/longtuos"
? ? ? ? ? ? android:layout_weight="1"/>
? ? ? ? <TextView
? ? ? ? ? ? android:layout_width="0dp"
? ? ? ? ? ? android:layout_height="wrap_content"
? ? ? ? ? ? android:layout_marginLeft="20dp"
? ? ? ? ? ? android:text="林丹羽毛球鞋"
? ? ? ? ? ? android:textSize="35sp"
? ? ? ? ? ? android:layout_weight="3"/>
? ? ? ? <Button
? ? ? ? ? ? android:layout_width="0dp"
? ? ? ? ? ? android:layout_height="wrap_content"
? ? ? ? ? ? android:id="@+id/btn_3"
? ? ? ? ? ? android:text="加入購(gòu)物車"
? ? ? ? ? ? android:layout_weight="1"/>
? ? ? ? <Button
? ? ? ? ? ? android:layout_width="0dp"
? ? ? ? ? ? android:layout_height="wrap_content"
? ? ? ? ? ? android:id="@+id/btn_4"
? ? ? ? ? ? android:text="購(gòu)買"
? ? ? ? ? ? android:layout_weight="1"/>
? ? </LinearLayout>
</LinearLayout>

Activity_Show .xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
? ? xmlns:android="http://schemas.android.com/apk/res/android"
? ? xmlns:tools="http://schemas.android.com/tools"
? ? android:layout_width="match_parent"
? ? android:layout_height="match_parent"
? ? android:background="@drawable/back"
? ? android:orientation="vertical"
? ? tools:context=".MainActivity">
? ? <LinearLayout
? ? ? ? android:layout_width="match_parent"
? ? ? ? android:layout_height="wrap_content"
? ? ? ? android:layout_marginTop="70dp"
? ? ? ? android:layout_marginBottom="50dp"
? ? ? ? android:orientation="horizontal"
? ? ? ? android:padding="20dp">
? ? ? ? <ImageView
? ? ? ? ? ? android:id="@+id/pet"
? ? ? ? ? ? android:layout_width="100dp"
? ? ? ? ? ? android:layout_height="100dp"
? ? ? ? ? ? android:background="@drawable/head"/>
? ? ? ? <LinearLayout
? ? ? ? ? ? android:layout_width="0dp"
? ? ? ? ? ? android:layout_height="wrap_content"
? ? ? ? ? ? android:layout_weight="1"
? ? ? ? ? ? android:layout_gravity="center"
? ? ? ? ? ? android:orientation="vertical"
? ? ? ? ? ? android:paddingLeft="40dp">
? ? ? ? ? ? <TextView
? ? ? ? ? ? ? ? android:id="@+id/tv_name"
? ? ? ? ? ? ? ? android:layout_width="wrap_content"
? ? ? ? ? ? ? ? android:layout_height="wrap_content"
? ? ? ? ? ? ? ? android:text=" "
? ? ? ? ? ? ? ? android:textSize="20sp"
? ? ? ? ? ? ? ? android:textColor="#33cc00"/>
? ? ? ? ? ? <TextView
? ? ? ? ? ? ? ? android:id="@+id/tv_password"
? ? ? ? ? ? ? ? android:layout_width="wrap_content"
? ? ? ? ? ? ? ? android:layout_height="wrap_content"
? ? ? ? ? ? ? ? android:layout_marginTop="20dp"
? ? ? ? ? ? ? ? android:text=" "
? ? ? ? ? ? ? ? android:textSize="20sp"
? ? ? ? ? ? ? ? android:textColor="#33cc00"/>
? ? ? ? </LinearLayout>
? ? </LinearLayout>
? ? <TableLayout
? ? ? ? android:layout_width="fill_parent"
? ? ? ? android:layout_height="wrap_content"
? ? ? ? android:layout_gravity="center"
? ? ? ? android:layout_marginBottom="50dp"
? ? ? ? android:layout_marginLeft="20dp"
? ? ? ? android:layout_marginRight="5dp">
? ? ? ? <TableRow
? ? ? ? ? ? android:layout_width="fill_parent"
? ? ? ? ? ? android:layout_height="wrap_content">
? ? ? ? ? ? <TextView
? ? ? ? ? ? ? ? android:layout_width="0dip"
? ? ? ? ? ? ? ? android:layout_height="wrap_content"
? ? ? ? ? ? ? ? android:layout_weight="9"
? ? ? ? ? ? ? ? android:text="背景是北宋郭忠恕的明皇避暑宮圖"
? ? ? ? ? ? ? ? android:textColor="#ff0000"
? ? ? ? ? ? ? ? android:textSize="25sp" />
? ? ? ? ? ? <TextView
? ? ? ? ? ? ? ? android:id="@+id/tv_food_progress"
? ? ? ? ? ? ? ? android:layout_width="0dip"
? ? ? ? ? ? ? ? android:layout_height="wrap_content"
? ? ? ? ? ? ? ? android:layout_weight="1"
? ? ? ? ? ? ? ? android:layout_gravity="center"
? ? ? ? ? ? ? ? android:text=" "
? ? ? ? ? ? ? ? android:textColor="#99ff77"
? ? ? ? ? ? ? ? android:textSize="40sp"/>
? ? ? ? </TableRow>
? ? </TableLayout>
? ? <LinearLayout
? ? ? ? android:layout_width="match_parent"
? ? ? ? android:layout_height="wrap_content"
? ? ? ? android:orientation="vertical">
? ? ? ? <Button
? ? ? ? ? ? android:layout_gravity="center"
? ? ? ? ? ? android:layout_marginLeft="28dp"
? ? ? ? ? ? android:layout_marginRight="50dp"
? ? ? ? ? ? android:layout_width="100dp"
? ? ? ? ? ? android:layout_height="100dp"
? ? ? ? ? ? android:background="@drawable/a"
? ? ? ? ? ? android:onClick="click0"/>
? ? ? ? <Button
? ? ? ? ? ? android:layout_gravity="center"
? ? ? ? ? ? android:layout_marginRight="28dp"
? ? ? ? ? ? android:layout_width="100dp"
? ? ? ? ? ? android:layout_height="100dp"
? ? ? ? ? ? android:background="@drawable/buy"
? ? ? ? ? ? android:layout_marginTop="90px"
? ? ? ? ? ? android:onClick="click1"/>
? ? </LinearLayout>
? ? <Button
? ? ? ? android:layout_width="900px"
? ? ? ? android:layout_height="100px"
? ? ? ? android:layout_marginTop="50dp"
? ? ? ? android:text="鞋的列表展示"
? ? ? ? android:onClick="click2"
? ? ? ? android:textColor="#ff0000"
? ? ? ? android:background="#99ff00"/>
</LinearLayout>

運(yùn)行結(jié)果展示圖

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論