parent
ff7af13a9e
commit
6b9dc685d0
@ -0,0 +1,60 @@
|
||||
package com.example.leudaemialikeme.Activity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ListView;
|
||||
import android.widget.Switch;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.example.leudaemialikeme.R;
|
||||
import com.example.leudaemialikeme.adapter.AdapterClock;
|
||||
|
||||
|
||||
public class MdctRmdActivity extends AppCompatActivity {
|
||||
|
||||
private ListView lv;
|
||||
private AdapterClock adapter;
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_mdctrmd);
|
||||
|
||||
ImageView back;
|
||||
back =findViewById(R.id.back_to_index);
|
||||
back.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent i = new Intent(MdctRmdActivity.this, MainActivity.class);
|
||||
i.putExtra("flag",1);
|
||||
startActivity(i);
|
||||
}
|
||||
});
|
||||
|
||||
lv=(ListView)findViewById(R.id.lv_list_data);
|
||||
adapter=new AdapterClock(MdctRmdActivity.this);
|
||||
|
||||
|
||||
lv.setAdapter(adapter);
|
||||
lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
|
||||
Switch aSwitch=adapter.getaSwitch(i);
|
||||
if(aSwitch.isChecked()){
|
||||
aSwitch.setChecked(false);
|
||||
//进行业务处理
|
||||
}else {
|
||||
aSwitch.setChecked(true);
|
||||
//进行业务处理
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,29 @@
|
||||
package com.example.leudaemialikeme.Activity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.example.leudaemialikeme.R;
|
||||
|
||||
public class SearchActivity extends AppCompatActivity {
|
||||
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_search);
|
||||
ImageView back;
|
||||
back =findViewById(R.id.search_to_index);
|
||||
|
||||
back.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent i = new Intent(SearchActivity.this, MainActivity.class);
|
||||
i.putExtra("flag",1);
|
||||
startActivity(i);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
package com.example.leudaemialikeme.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.Switch;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.example.leudaemialikeme.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class AdapterClock extends BaseAdapter {
|
||||
|
||||
private String[] names={"甘露聚糖肽胶囊","消癌平糖浆"};
|
||||
private String[] time={"每天 8:00 14:00 19:00","每天 8:00 14:00 19:00"};
|
||||
private List<Switch> list_switch;
|
||||
|
||||
private Context mContext;
|
||||
|
||||
private TextView tv1,tv2;
|
||||
private Switch aSwitch;
|
||||
|
||||
public AdapterClock(Context context) {
|
||||
mContext=context;
|
||||
list_switch=new ArrayList<>();
|
||||
}
|
||||
|
||||
|
||||
public Switch getaSwitch(int position){
|
||||
|
||||
return list_switch.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return names.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int i) {
|
||||
return names[i];
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int i) {
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int i, View view, ViewGroup viewGroup) {
|
||||
|
||||
view= LayoutInflater.from(mContext).inflate(R.layout.list_item,null);
|
||||
tv1=(TextView)view.findViewById(R.id.md_name);
|
||||
tv2=(TextView)view.findViewById(R.id.md_time);
|
||||
aSwitch=(Switch)view.findViewById(R.id.sw);
|
||||
|
||||
list_switch.add(aSwitch);
|
||||
|
||||
tv1.setText(names[i]);
|
||||
tv2.setText(time[i]);
|
||||
|
||||
|
||||
return view;
|
||||
}
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
package com.example.leudaemialikeme.adapter;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.example.leudaemialikeme.R;
|
||||
import com.example.leudaemialikeme.Recnews;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class InfoAdapter extends RecyclerView.Adapter<InfoAdapter.ViewHolder> {
|
||||
private List<Recnews> mRecnewsList;
|
||||
|
||||
static class ViewHolder extends RecyclerView.ViewHolder{
|
||||
ImageView image;
|
||||
TextView theme;
|
||||
TextView intro;
|
||||
TextView visNum;
|
||||
TextView time;
|
||||
public ViewHolder(View view){
|
||||
super(view);
|
||||
image=(ImageView)view.findViewById(R.id.recNews_image);
|
||||
theme=(TextView)view.findViewById(R.id.recNews_theme);
|
||||
intro=(TextView)view.findViewById(R.id.recNews_intro);
|
||||
visNum=(TextView)view.findViewById(R.id.recNews_visNum);
|
||||
time=(TextView)view.findViewById(R.id.recNews_time);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public InfoAdapter(List<Recnews> recnewsList){
|
||||
mRecnewsList=recnewsList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
View view= LayoutInflater.from(parent.getContext()).inflate(R.layout.info_item,parent,false);
|
||||
ViewHolder holder=new ViewHolder(view);
|
||||
return holder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull InfoAdapter.ViewHolder holder, int position) {
|
||||
Recnews recnews=mRecnewsList.get(position);
|
||||
holder.image.setImageResource(recnews.getImageNum());
|
||||
holder.visNum.setText(String.valueOf(recnews.getVisNum()));
|
||||
holder.intro.setText(recnews.getIntro());
|
||||
holder.theme.setText(recnews.getTheme());
|
||||
holder.time.setText(recnews.getTime());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mRecnewsList.size();
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 9.1 KiB |
After Width: | Height: | Size: 3.0 KiB |
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle"
|
||||
>
|
||||
<corners android:radius="25dp" />
|
||||
<solid android:color="#FFFFFF" />
|
||||
<padding
|
||||
android:bottom="3dp"
|
||||
android:left="10dp"
|
||||
android:right="5dp"
|
||||
android:top="3dp" />
|
||||
<stroke
|
||||
android:width="2dp"
|
||||
android:color="@color/light_grey"/>
|
||||
</shape>
|
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners android:radius="16dp" />
|
||||
<solid android:color="#ffdfbe" />
|
||||
|
||||
|
||||
</shape>
|
@ -0,0 +1,73 @@
|
||||
<?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">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="80dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/back_to_index"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginTop="23dp"
|
||||
android:src="@drawable/back" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/head_rmd"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:textSize="30dp"
|
||||
android:layout_marginTop="23dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:text="服药提醒" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/add_md"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginTop="23dp"
|
||||
android:src="@drawable/add" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/dp_line"
|
||||
android:layout_height="1px"
|
||||
android:background="#000000"
|
||||
android:layout_width="fill_parent">
|
||||
</View>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/subtitle_clock"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="25dp"
|
||||
android:textSize="35dp"
|
||||
android:text="闹钟" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ListView
|
||||
android:id="@+id/lv_list_data"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -0,0 +1,163 @@
|
||||
<?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="vertical">
|
||||
<!--定义一个SearchView-->
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/search_to_index"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginTop="23dp"
|
||||
|
||||
android:src="@drawable/back" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="311dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:background="@drawable/shape_round_corner"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<SearchView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent" >
|
||||
|
||||
</SearchView>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/EditText"
|
||||
android:layout_width="240dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="@null"
|
||||
android:gravity="center_vertical"
|
||||
android:text="请输入搜索内容" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="32dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_weight="1"
|
||||
android:textSize="18dp"
|
||||
android:text="搜索"
|
||||
android:textColor="#f47920"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="搜索发现"
|
||||
android:textSize="20dp"
|
||||
android:layout_margin="30dp"
|
||||
android:textColor="#000000"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView3"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="35dp"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/shape_round_corner"
|
||||
android:gravity="center"
|
||||
android:text="科普" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView4"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="35dp"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/shape_round_corner"
|
||||
android:gravity="center"
|
||||
android:text="食疗" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView5"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="35dp"
|
||||
android:layout_marginLeft="20dp"
|
||||
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/shape_round_corner"
|
||||
android:gravity="center"
|
||||
android:text="政策" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView6"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="35dp"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginRight="20dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/shape_round_corner"
|
||||
android:gravity="center"
|
||||
android:text="药物" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView7"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="35dp"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/shape_round_corner"
|
||||
android:gravity="center"
|
||||
android:text="暖心故事" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView8"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="35dp"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/shape_round3_corner"
|
||||
android:textColor="#f47920"
|
||||
android:gravity="center"
|
||||
android:text="专家问答" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
@ -0,0 +1,37 @@
|
||||
<?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:layout_margin="18dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="60dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/md_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="甘露聚糖肽胶囊"
|
||||
android:textSize="25dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/md_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="每天 8:00 14:00 19:00" />
|
||||
</LinearLayout>
|
||||
|
||||
<Switch
|
||||
android:id="@+id/sw"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="60dp"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:focusable="false"
|
||||
android:clickable="false"
|
||||
android:padding="10dp"
|
||||
android:layout_alignParentRight="true"/>
|
||||
</LinearLayout>
|
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string-array name="languages">
|
||||
<item>全部</item>
|
||||
<item>公司</item>
|
||||
<item>红十字</item>
|
||||
<item>政府</item>
|
||||
<item>慈善</item>
|
||||
</string-array>
|
||||
</resources>
|
Loading…
Reference in new issue