实现fragment切换,index界面布局

master
ghtMare 2 years ago
parent 8b58e99d71
commit 53fe5cc752

@ -12,6 +12,7 @@
<activity
android:name=".activity.GoodsActivity"
android:exported="false" />
<activity android:name=".activity.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@ -22,6 +23,8 @@
<activity android:name=".activity.RegisterActivity" />
<activity android:name=".activity.UserActivity" />
<activity android:name=".activity.UserMessageActivity" />
<activity android:name=".activity.IndexActivity"
android:exported="false"/>
</application>
</manifest>

@ -0,0 +1,138 @@
package com.example.Cat.activity;
import android.app.Activity;
import android.app.FragmentTransaction;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.Nullable;
import com.example.Cat.R;
import com.example.Cat.fragment.IndexFragment;
import com.example.Cat.fragment.PearsonFragment;
import com.example.Cat.fragment.ProductFragment;
import com.example.Cat.fragment.ShoppingCartFragment;
public class IndexActivity extends Activity implements View.OnClickListener {
private IndexFragment indexFragment;
private ProductFragment productFragment;
private ShoppingCartFragment shoppingCartFragment;
private PearsonFragment pearsonFragment;
String username;
private LinearLayout indexLine, productLine, shoppingCartLine, pearsonLine;
Intent intent_message;
TextView usernameText;
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_index);
init();
initIndexFragment();
// Thread thread = new Thread(runnable);
//thread.start();
}
/**
*
*/
private void init() {
indexLine = findViewById(R.id.content_index);
indexLine.setOnClickListener(this);
productLine = findViewById(R.id.content_product);
productLine.setOnClickListener(this);
shoppingCartLine = findViewById(R.id.content_cart);
shoppingCartLine.setOnClickListener(this);
pearsonLine = findViewById(R.id.content_pearson);
pearsonLine.setOnClickListener(this);
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.content_index:
initIndexFragment();
break;
case R.id.content_product:
initproductFragment();
break;
case R.id.content_cart:
initshoppingCartFragment();
break;
case R.id.content_pearson:
initpearsonFragment();
break;
}
}
/**
* Fragment
*/
private void initIndexFragment() {
//开启事务fragment的控制是由事务来实现的
FragmentTransaction transaction = getFragmentManager().beginTransaction();
if (indexFragment == null) {
indexFragment = new IndexFragment();
}
transaction.replace(R.id.main_content, indexFragment);
transaction.commit();
}
/**
* Fragment
*/
private void initproductFragment() {
//开启事务fragment的控制是由事务来实现的
FragmentTransaction transaction = getFragmentManager().beginTransaction();
if (productFragment == null) {
productFragment = new ProductFragment();
}
transaction.replace(R.id.main_content, productFragment);
transaction.commit();
}
/**
* Fragment
*/
private void initshoppingCartFragment() {
//开启事务fragment的控制是由事务来实现的
FragmentTransaction transaction = getFragmentManager().beginTransaction();
if (shoppingCartFragment == null) {
shoppingCartFragment = new ShoppingCartFragment();
}
transaction.replace(R.id.main_content, shoppingCartFragment);
transaction.commit();
}
/**
* Fragment
*/
private void initpearsonFragment() {
//开启事务fragment的控制是由事务来实现的
FragmentTransaction transaction = getFragmentManager().beginTransaction();
if (pearsonFragment == null) {
Intent intent = IndexActivity.this.getIntent();
Bundle bundle = intent.getExtras();
pearsonFragment = new PearsonFragment();
pearsonFragment.setArguments(bundle);
}
usernameText=pearsonFragment.usernameText;
transaction.replace(R.id.main_content, pearsonFragment);
transaction.commit();
}
// public Intent getIntentm(){
// intent_message=new Intent(this,UserMessageActivity.class);
// return intent_message;
// }
// public void intentopration(){
// getIntentm().putExtra("username",usernameText.getText().toString());
// }
}

@ -57,7 +57,7 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
//验证密码是否正确
public void Verification(){
//UserInfo info;
Intent intent = new Intent(MainActivity.this, UserActivity.class);
Intent intent = new Intent(MainActivity.this, IndexActivity.class);
//intent.putExtra("username",usernameText.getText().toString());
User_Database user=new User_Database(MainActivity.this);
SQLiteDatabase sqLiteDatabase=user.getReadableDatabase();

@ -0,0 +1,70 @@
package com.example.Cat.adapter;
import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.example.Cat.R;
import com.example.Cat.entity.Product;
import java.util.List;
public class ProductAdapter extends BaseAdapter {
private List<Product> productList;
private LayoutInflater layoutInflater;
public ProductAdapter(Context context, List<Product> productList) {
this.productList = productList;
this.layoutInflater = LayoutInflater.from(context);
}
@Override
public int getCount() {
return productList.size();
}
@Override
public Object getItem(int position) {
return productList.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder viewHolder;
if (convertView == null) {
Log.i("aa", "getView: "+"aa");
convertView = layoutInflater.inflate(R.layout.categoty_detail_content, null);
viewHolder = new ViewHolder();
viewHolder.productImage = convertView.findViewById(R.id.category_product_image);
viewHolder.productName = convertView.findViewById(R.id.category_product_name);
viewHolder.productPrice = convertView.findViewById(R.id.category_product_price);
convertView.setTag(viewHolder);
} else {
viewHolder = (ViewHolder) convertView.getTag();
}
Product product = productList.get(position);
Log.i("product", "getView: "+product.toString());
if (product != null) {
viewHolder.productImage.setBackgroundResource(product.getImageUrlId());
viewHolder.productName.setText(product.getProductName());
viewHolder.productPrice.setText(String.valueOf(product.getProductPrice()));
}
return convertView;
}
class ViewHolder {
ImageView productImage;
TextView productName, productPrice;
}
}

@ -0,0 +1,44 @@
package com.example.Cat.entity;
import java.math.BigDecimal;
public class Product {
public String getProductName() {
return productName;
}
public void setProductName(String productName) {
this.productName = productName;
}
public BigDecimal getProductPrice() {
return productPrice;
}
public void setProductPrice(BigDecimal productPrice) {
this.productPrice = productPrice;
}
public Integer getImageUrlId() {
return imageUrlId;
}
public void setImageUrlId(Integer imageUrlId) {
this.imageUrlId = imageUrlId;
}
private Integer imageUrlId;
private String productName;
private BigDecimal productPrice;
@Override
public String toString() {
return "Product{" +
"imageUrlId=" + imageUrlId +
", productName='" + productName + '\'' +
", productPrice=" + productPrice +
'}';
}
}

@ -0,0 +1,120 @@
package com.example.Cat.fragment;
import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.GridView;
import android.widget.LinearLayout;
import android.widget.SearchView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.example.Cat.R;
import com.example.Cat.adapter.ProductAdapter;
import com.example.Cat.entity.Product;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
public class IndexFragment extends Fragment implements View.OnClickListener {
private SearchView searchView;
private LinearLayout orangeLine, youziLine, juziLine, xiguaLine, liLine, appleLine, lemonLine, mangguoLine;
private GridView gridView;
private ProductAdapter productAdapter;
private List<Product> productList;
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = LayoutInflater.from(getActivity()).inflate(R.layout.content_index, container, false);
init(view);
return view;
}
/**
*
*/
private void init(View view) {
searchView = view.findViewById(R.id.searchView);
searchView.setOnClickListener(this);
orangeLine = view.findViewById(R.id.wjy);
orangeLine.setOnClickListener(this);
youziLine = view.findViewById(R.id.ml);
youziLine.setOnClickListener(this);
juziLine = view.findViewById(R.id.ml2);
juziLine.setOnClickListener(this);
xiguaLine = view.findViewById(R.id.ml3);
xiguaLine.setOnClickListener(this);
liLine = view.findViewById(R.id.mlp);
liLine.setOnClickListener(this);
lemonLine = view.findViewById(R.id.mlp2);
lemonLine.setOnClickListener(this);
mangguoLine = view.findViewById(R.id.wj);
mangguoLine.setOnClickListener(this);
appleLine = view.findViewById(R.id.wj2);
appleLine.setOnClickListener(this);
gridView = view.findViewById(R.id.index_famous_gridview);
initData();
productAdapter = new ProductAdapter(getActivity(), productList);
gridView.setAdapter(productAdapter);
}
@Override
public void onClick(View v) {
}
/**
*
*/
private void initData() {
productList = new ArrayList<>();
Product product = new Product();
product.setImageUrlId(R.drawable.mlp);
product.setProductName("猫粮盆");
product.setProductPrice(new BigDecimal("9.9"));
Product product1 = new Product();
product1.setImageUrlId(R.drawable.ml);
product1.setProductName("猫粮");
product1.setProductPrice(new BigDecimal("29.9"));
Product product2 = new Product();
product2.setImageUrlId(R.drawable.mwj3);
product2.setProductName("玩具");
product2.setProductPrice(new BigDecimal("19.9"));
Product product3 = new Product();
product3.setImageUrlId(R.drawable.ml3);
product3.setProductName("美味猫粮");
product3.setProductPrice(new BigDecimal("19.9"));
Product product4 = new Product();
product4.setImageUrlId(R.drawable.ml2);
product4.setProductName("营养猫粮");
product4.setProductPrice(new BigDecimal("49.9"));
Product product5 = new Product();
product5.setImageUrlId(R.drawable.mwj);
product5.setProductName("玩具");
product5.setProductPrice(new BigDecimal("9.9"));
Product product6=new Product();
product6.setImageUrlId(R.drawable.mwj2);
product6.setProductName("玩具");
product6.setProductPrice(new BigDecimal("9.9"));
Product product7=new Product();
product7.setImageUrlId(R.drawable.xmw);
product7.setProductName("小型猫窝");
product7.setProductPrice(new BigDecimal("29.9"));
productList.add(product);
productList.add(product1);
productList.add(product2);
productList.add(product3);
productList.add(product4);
productList.add(product5);
productList.add(product6);
productList.add(product7);
}
}

@ -0,0 +1,110 @@
package com.example.Cat.fragment;
import android.app.Fragment;
import android.app.FragmentTransaction;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.example.Cat.R;
import com.example.Cat.activity.GoodsActivity;
import com.example.Cat.activity.IndexActivity;
import com.example.Cat.activity.MainActivity;
import com.example.Cat.activity.UserMessageActivity;
public class PearsonFragment extends Fragment implements View.OnClickListener {
private ImageView userIconImage;
public TextView usernameText, userSexText, userCityText;
public LinearLayout userProductLine,usernameLine, userSexline, userCityLine, userPayLine, userSettingLine, userGeneralLine;
public Button button;
public String username;
IndexActivity indexActivity;
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = LayoutInflater.from(getActivity()).inflate(R.layout.content_user, container, false);
init(view);
return view;
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
button=(Button) getActivity().findViewById(R.id.exit);
userProductLine=(LinearLayout) getActivity().findViewById(R.id.user_product);
userSettingLine=(LinearLayout) getActivity().findViewById(R.id.user_setting);
button.setOnClickListener(this);
userSettingLine.setOnClickListener(this);
userProductLine.setOnClickListener(this);
}
/**
*
*/
private void init(View view) {
userIconImage = view.findViewById(R.id.user_icon);
usernameText = view.findViewById(R.id.user_username);
//userSexText = view.findViewById(R.id.user_sex);
// userCityText = view.findViewById(R.id.user_city);
usernameLine = view.findViewById(R.id.user_username_line);
// userSexline = view.findViewById(R.id.user_sex_line);
// userCityLine = view.findViewById(R.id.user_city_line);
// userPayLine = view.findViewById(R.id.user_pay);
userSettingLine = view.findViewById(R.id.user_setting);
// userGeneralLine = view.findViewById(R.id.user_general);
userProductLine = view.findViewById(R.id.user_product);
// userProductLine.setOnClickListener(this);
// userSettingLine.setOnClickListener(this);
button=view.findViewById(R.id.exit);
// button.setOnClickListener(this);
setData();
}
/**
*
*/
private void setData() {
Bundle bundle = getArguments();
usernameText.setText(String.format("用户名:%s", bundle.getString("username")));
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.user_product:
Intent intent2 = new Intent(getActivity(), GoodsActivity.class);
startActivity(intent2);
break;
// case R.id.user_setting:
// Intent intent3 = new Intent(getActivity(), UserMessageActivity.class);
// intent3.putExtra("username",username);
// startActivity(intent3);
// break;
case R.id.exit:
Intent intent4 = new Intent(getActivity(), MainActivity.class);
startActivity(intent4);
}
}
// private void initInnerFragment() {
// //开启事务fragment的控制是由事务来实现的
// FragmentTransaction transaction = getFragmentManager().beginTransaction();
// if (innerFragment == null) {
// innerFragment = new InnerFragment();
// }
// transaction.replace(R.id.main_content, innerFragment);
// transaction.commit();
// }
}

@ -0,0 +1,21 @@
package com.example.Cat.fragment;
import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.example.Cat.R;
public class ProductFragment extends Fragment {
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = LayoutInflater.from(getActivity()).inflate(R.layout.content_product, container, false);
return view;
}
}

@ -0,0 +1,21 @@
package com.example.Cat.fragment;
import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.example.Cat.R;
public class ShoppingCartFragment extends Fragment {
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = LayoutInflater.from(getActivity()).inflate(R.layout.content_shopping, container, false);
return view;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 231 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<!-- 连框颜色值 -->
<item>
<shape>
<solid android:color="#dddddd" />
</shape>
</item>
<!-- 主体背景颜色值 -->
<item android:bottom="1dp"> <!--设置只有底部有边框-->
<shape>
<solid android:color="#ffffff" />
<corners android:radius="10dp"></corners>
</shape>
</item>
</layer-list>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 592 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 799 B

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="#F0A732" android:state_selected="true" />
<item android:color="#CFCFCF" />
</selector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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"
android:orientation="vertical"
tools:context=".IndexActivity">
<FrameLayout
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="70dp">
<!--底部导航-->
<include layout="@layout/content_nav" />
</LinearLayout>
</LinearLayout>

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#fff"
android:orientation="vertical">
<ImageView
android:id="@+id/category_product_image"
android:layout_width="wrap_content"
android:layout_marginTop="5dp"
android:layout_height="wrap_content"
android:layout_gravity="center" />
<TextView
android:id="@+id/category_product_name"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_gravity="center"
android:layout_marginTop="2dp"
android:textColor="#050505"
android:textSize="16sp" />
<TextView
android:id="@+id/category_product_price"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_gravity="center"
android:layout_marginTop="2dp"
android:gravity="center"
android:textColor="#050505"
android:textSize="16sp" />
</LinearLayout>

@ -0,0 +1,221 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#E8E8E8"
android:orientation="vertical">
<SearchView
android:id="@+id/searchView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/index_menu"
android:focusable="false"
android:iconifiedByDefault="false"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="1dp"
android:layout_marginTop="20dp"
android:layout_marginRight="1dp"
android:background="@drawable/index_menu"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/wjy"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ml" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="鱼玩具"
android:textColor="#696969"
android:textSize="20sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/ml"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ml1" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="美味猫粮"
android:textColor="#696969"
android:textSize="20sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/ml2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ml2" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="营养猫粮"
android:textColor="#696969"
android:textSize="20sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/ml3"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ml3" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="猫粮"
android:textColor="#696969"
android:textSize="20sp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:layout_marginBottom="5dp"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/mlp"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/mlp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="猫粮盆"
android:textColor="#696969"
android:textSize="20sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/mlp2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/mlp2" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="猫粮盆"
android:textColor="#696969"
android:textSize="20sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/wj"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/mwj" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="玩具钓具"
android:textColor="#696969"
android:textSize="20sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/wj2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/mwj2" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="玩具球"
android:textColor="#696969"
android:textSize="20sp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<include layout="@layout/index_famous"/>
</LinearLayout>

@ -0,0 +1,119 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<!--首页-->
<LinearLayout
android:id="@+id/content_index"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="2dp"
android:src="@drawable/index" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Index"
android:textColor="#000"
android:textSize="18sp" />
</LinearLayout>
<!--间隔线-->
<ImageView
android:layout_width="1dp"
android:layout_height="70dp"
android:background="#CFCFCF" />
<!--商品-->
<LinearLayout
android:id="@+id/content_product"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="2dp"
android:src="@drawable/product" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="goods"
android:textColor="#000"
android:textSize="18sp" />
</LinearLayout>
<!--间隔线-->
<ImageView
android:layout_width="1dp"
android:layout_height="70dp"
android:background="#CFCFCF" />
<!--购物车-->
<LinearLayout
android:id="@+id/content_cart"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginTop="2dp"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="@drawable/shoppingcart" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="cart"
android:textColor="#000"
android:textSize="18sp" />
</LinearLayout>
<!--间隔线-->
<ImageView
android:layout_width="1dp"
android:layout_height="70dp"
android:background="#CFCFCF" />
<!--个人-->
<LinearLayout
android:id="@+id/content_pearson"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginTop="2dp"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="@drawable/pearson" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Me"
android:textColor="#000"
android:textSize="18sp" />
</LinearLayout>
</LinearLayout>

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
</LinearLayout>

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
</LinearLayout>

@ -3,7 +3,8 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#E8E8E8"
android:orientation="vertical">
android:orientation="vertical"
android:id="@+id/user">
<!--头像-->
<LinearLayout

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:orientation="vertical">
<!--热门商品-->
<LinearLayout
android:id="@+id/index_famous_product"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:background="#FFF"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="50dp"
android:layout_marginLeft="5dp"
android:layout_weight="1"
android:drawableLeft="@drawable/mhot"
android:drawablePadding="8dp"
android:gravity="center_vertical"
android:text="popular"
android:textColor="#000"
android:textSize="18sp" />
<ImageView
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_gravity="center"
android:src="@drawable/arrow_right" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:orientation="vertical">
<GridView
android:id="@+id/index_famous_gridview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#E8E8E8"
android:verticalSpacing="10dp"
android:horizontalSpacing="10dp"
android:numColumns="2" />
</LinearLayout>
</LinearLayout>

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
</LinearLayout>
Loading…
Cancel
Save