fragment_index_update

master
hjw 4 years ago
parent a7abd21c4d
commit e600681a27

@ -29,17 +29,21 @@ public class InfoActivity extends AppCompatActivity {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_info);
Intent intent=getIntent();
int infoType=intent.getIntExtra("info_type",4);
List<String> typeList = new ArrayList<String>();
typeList.add("全部");
typeList.add("公司");
typeList.add("红十字");
typeList.add("政府");
typeList.add("慈善");
typeList.add("全部");
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, typeList);
adapter.setDropDownViewResource(android.R.layout.simple_list_item_single_choice);
Spinner sp = (Spinner) findViewById(R.id.info_type);
sp.setAdapter(adapter);
sp.setSelection(infoType,true);
sp.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
// parent 为控件Spinner view显示文字的TextView position下拉选项的位置从0开始
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {

@ -16,7 +16,7 @@ import com.example.leudaemialikeme.Activity.MdctRmdActivity;
import com.example.leudaemialikeme.Activity.SearchActivity;
import com.example.leudaemialikeme.R;
import com.example.leudaemialikeme.Recnews;
import com.example.leudaemialikeme.adapter.RecnewsAdapter;
import com.example.leudaemialikeme.Adapter.RecnewsAdapter;
import java.util.ArrayList;
import java.util.List;
@ -135,6 +135,8 @@ public class IndexFragment extends Fragment {
@Override
public void onClick(View view) {
Intent intent=new Intent(getContext(), InfoActivity.class);
int data=0;
intent.putExtra("info_type",data);
startActivity(intent); }
});
@ -143,6 +145,8 @@ public class IndexFragment extends Fragment {
@Override
public void onClick(View view) {
Intent intent=new Intent(getContext(), InfoActivity.class);
int data=1;
intent.putExtra("info_type",data);
startActivity(intent); }
});
@ -151,6 +155,8 @@ public class IndexFragment extends Fragment {
@Override
public void onClick(View view) {
Intent intent=new Intent(getContext(), InfoActivity.class);
int data=2;
intent.putExtra("info_type",data);
startActivity(intent); }
});
@ -159,6 +165,8 @@ public class IndexFragment extends Fragment {
@Override
public void onClick(View view) {
Intent intent=new Intent(getContext(), InfoActivity.class);
int data=3;
intent.putExtra("info_type",data);
startActivity(intent); }
});
@ -167,6 +175,8 @@ public class IndexFragment extends Fragment {
@Override
public void onClick(View view) {
Intent intent=new Intent(getContext(), InfoActivity.class);
int data=4;
intent.putExtra("info_type",data);
startActivity(intent);
}
});
@ -182,7 +192,7 @@ public class IndexFragment extends Fragment {
"儿童急性B淋巴细胞白血病,除了传统疗法还有哪些前沿治疗方法呢?",
"急性淋巴细胞白血病ALL是儿童最常见的恶性肿瘤其中约85%为……"
,102,"2021-11-6 09:19:54"
);
);
recNews.add(news1);
Recnews news2=new Recnews(R.drawable.rec_news2,
"儿童急性B淋巴细胞白血病,除了传统疗法还有哪些前沿治疗方法呢?",

@ -19,7 +19,7 @@
<ImageView
android:id="@+id/back_to_index"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_height="34dp"
android:layout_marginTop="23dp"
android:src="@drawable/back" />
@ -28,14 +28,14 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="30dp"
android:textSize="25dp"
android:layout_marginTop="23dp"
android:gravity="center_horizontal"
android:text="服药提醒" />
<ImageView
android:id="@+id/add_md"
android:layout_width="40dp"
android:layout_width="34dp"
android:layout_height="40dp"
android:layout_marginTop="23dp"
android:src="@drawable/add" />
@ -53,8 +53,9 @@
android:id="@+id/subtitle_clock"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="25dp"
android:textSize="35dp"
android:layout_marginLeft="25dp"
android:layout_marginTop="25dp"
android:textSize="20dp"
android:text="闹钟" />
<LinearLayout
@ -63,6 +64,7 @@
android:orientation="vertical">
<ListView
android:layout_margin="18dp"
android:id="@+id/lv_list_data"
android:layout_width="match_parent"
android:layout_height="match_parent" />
@ -70,4 +72,4 @@
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

@ -14,13 +14,16 @@
android:id="@+id/md_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="7dp"
android:paddingTop="5dp"
android:text="甘露聚糖肽胶囊"
android:textSize="25dp" />
android:textSize="16dp" />
<TextView
android:id="@+id/md_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="每天 8:00 14:00 19:00" />
</LinearLayout>
@ -34,4 +37,4 @@
android:clickable="false"
android:padding="10dp"
android:layout_alignParentRight="true"/>
</LinearLayout>
</LinearLayout>

Loading…
Cancel
Save