parent
60f32b1980
commit
5e8769e4dd
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RenderSettings">
|
||||
<option name="showDecorations" value="true" />
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,46 @@
|
||||
package com.android.activity;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
|
||||
import com.android.R;
|
||||
import com.android.bean.Good;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
public class GoodsDetailsActivity extends AppCompatActivity {
|
||||
private Good good;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_goods_details);
|
||||
//注册EventBus
|
||||
EventBus.getDefault().register(this);
|
||||
}
|
||||
|
||||
//拿取数据
|
||||
@Subscribe(threadMode = ThreadMode.MAIN,sticky = true)
|
||||
public void getGoods(Good data){
|
||||
if(data != null){
|
||||
this.good = data;
|
||||
Log.e("GoodsDetailsActivity",good.getContent());
|
||||
}else {
|
||||
Log.e("GoodsDetailsActivity","获取失败");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
EventBus.getDefault().unregister(this);
|
||||
super.onDestroy();
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".activity.GoodsDetailsActivity">
|
||||
<TextView
|
||||
android:id="@+id/tv_goods_show"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="商品详细页面"
|
||||
android:gravity="center"
|
||||
tools:ignore="MissingConstraints" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -1,61 +1,100 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<androidx.cardview.widget.CardView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/grey">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="280dp"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:layout_marginBottom="15dp"
|
||||
android:background="@color/white">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_image"
|
||||
app:cardUseCompatPadding="true"
|
||||
app:cardCornerRadius="10dp"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="200dp"
|
||||
android:scaleType="fitXY" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_content"
|
||||
android:layout_width="180dp"
|
||||
android:layout_height="25dp"
|
||||
android:layout_below="@+id/iv_image"
|
||||
android:layout_marginStart="13dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:layout_height="280dp"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:layout_marginBottom="15dp"
|
||||
android:textSize="20dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/str"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/tv_content"
|
||||
android:layout_alignLeft="@+id/tv_content"
|
||||
android:text="价格: "
|
||||
android:textColor="@color/red" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_price"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="18dp"
|
||||
android:layout_below="@+id/tv_content"
|
||||
android:layout_toRightOf="@+id/str"
|
||||
android:textColor="@color/red" />
|
||||
|
||||
|
||||
<!-- <TextView-->
|
||||
<!-- android:id="@+id/iv_delete"-->
|
||||
<!-- android:layout_width="30dp"-->
|
||||
<!-- android:layout_height="30dp"-->
|
||||
<!-- android:layout_alignEnd="@+id/tv_content"-->
|
||||
<!-- android:layout_alignBottom="@+id/tv_price"-->
|
||||
<!-- android:src="@drawable/ic_baseline_close_24" />-->
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
android:background="@color/white">
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_image"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="200dp"
|
||||
android:scaleType="fitXY" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_content"
|
||||
android:layout_width="180dp"
|
||||
android:layout_height="25dp"
|
||||
android:layout_below="@+id/iv_image"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:layout_marginBottom="15dp"
|
||||
android:textSize="20dp" />
|
||||
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_price"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="18dp"
|
||||
android:layout_below="@+id/tv_content"
|
||||
android:textColor="@color/red" />
|
||||
<TextView
|
||||
android:id="@+id/str"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/tv_content"
|
||||
android:layout_toRightOf="@+id/tv_price"
|
||||
android:text="@string/moneyType"
|
||||
android:textColor="@color/red" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/elevatedButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="加入购物车"
|
||||
style="Filled button"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_marginEnd="32dp"
|
||||
/>
|
||||
<!-- <Button-->
|
||||
<!-- android:id="@+id/bt_buy_now"-->
|
||||
<!-- android:layout_width="64dp"-->
|
||||
<!-- android:layout_height="32dp"-->
|
||||
<!-- android:text="立即购买"-->
|
||||
<!-- android:textColor="@color/teal_200"-->
|
||||
<!-- android:backgroundTint="@color/grey"-->
|
||||
<!-- android:layout_below="@id/tv_content"-->
|
||||
<!-- android:layout_marginStart="132dp"-->
|
||||
<!-- />-->
|
||||
<!-- <Button-->
|
||||
<!-- android:id="@+id/bt_add_to_cars"-->
|
||||
<!-- android:layout_width="64dp"-->
|
||||
<!-- android:layout_height="32dp"-->
|
||||
<!-- android:text="加入购物车"-->
|
||||
<!-- android:textColor="@color/teal_200"-->
|
||||
<!-- android:backgroundTint="@color/grey"-->
|
||||
<!-- android:layout_below="@id/tv_content"-->
|
||||
<!-- android:layout_marginStart="64dp"-->
|
||||
<!-- />-->
|
||||
|
||||
|
||||
|
||||
<!-- <TextView-->
|
||||
<!-- android:id="@+id/iv_delete"-->
|
||||
<!-- android:layout_width="30dp"-->
|
||||
<!-- android:layout_height="30dp"-->
|
||||
<!-- android:layout_alignEnd="@+id/tv_content"-->
|
||||
<!-- android:layout_alignBottom="@+id/tv_price"-->
|
||||
<!-- android:src="@drawable/ic_baseline_close_24" />-->
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
Loading…
Reference in new issue