diff --git a/app/src/main/java/com/example/SearchCenter/SearchEntryActivity.java b/app/src/main/java/com/example/SearchCenter/SearchEntryActivity.java index d8dd36b..bebed6a 100644 --- a/app/src/main/java/com/example/SearchCenter/SearchEntryActivity.java +++ b/app/src/main/java/com/example/SearchCenter/SearchEntryActivity.java @@ -81,7 +81,6 @@ public class SearchEntryActivity extends AppCompatActivity implements CardStackV Log.i("response+++++",response+"返回值"); try { - int code = response.getCode(); Log.i("code:",""+code); String message = response.getMsg(); @@ -189,9 +188,7 @@ public class SearchEntryActivity extends AppCompatActivity implements CardStackV /** * 病——症状 nm能吃什么药 */ - TextView textView=findViewById(R.id.asscoiate_entry); - textView.setText(response.getMsg()+"应该吃什么药"); - texts[0]=(String)textView.getText(); + texts[0]=response.getMsg()+"应该吃什么药"; model_Text=Model_Symptom; }else if(response.getCode()==DiseaseToMedicines){ /** @@ -200,10 +197,8 @@ public class SearchEntryActivity extends AppCompatActivity implements CardStackV */ Random r=new Random(); for(int i=0;i<3;i++) { - TextView textView = findViewById(R.id.asscoiate_entry); index[i] = r.nextInt(9) + 1; - textView.setText(content.get(index[i]) + "能治什么病症"); - texts[i]=(String)textView.getText(); + texts[i]=content.get(index[i])+"能治什么病症"; } model_Text=Model_Medicines; }else if(response.getCode()==MedicineToOperation){ @@ -211,21 +206,18 @@ public class SearchEntryActivity extends AppCompatActivity implements CardStackV * 药——操作方法 * nhm能治什么病 */ - TextView textView_1=findViewById(R.id.asscoiate_entry); - textView_1.setText(response.getMsg()+"能治什么病"); - texts[0]=(String)textView_1.getText(); + texts[0]=response.getMsg()+"能治什么病"; model_Text=Model_Function; }else { /** *药——作用,能治什么病 * nhm 操作方法 */ - TextView textView=findViewById(R.id.asscoiate_entry); - textView.setText(response.getMsg()+"的用法"); - texts[0]=(String)textView.getText(); + texts[0]=response.getMsg()+"的用法"; model_Text=Model_Operation; } - ArrayAdapter view_adapter = new ArrayAdapter(SearchEntryActivity.this,android.R.layout.simple_list_item_1, texts); + + ArrayAdapter view_adapter = new ArrayAdapter(SearchEntryActivity.this,R.layout.list_view, texts); ListView listView=findViewById(R.id.listview_group); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override diff --git a/app/src/main/res/layout/activity_search_entry.xml b/app/src/main/res/layout/activity_search_entry.xml index e9dcfca..f3434bd 100644 --- a/app/src/main/res/layout/activity_search_entry.xml +++ b/app/src/main/res/layout/activity_search_entry.xml @@ -19,25 +19,28 @@ android:textSize="24sp" android:text="你可能感兴趣" android:textStyle="bold" - android:paddingLeft="50dp" - android:paddingTop="100dp" + android:paddingLeft="100dp" + android:paddingTop="150dp" android:id="@+id/asscoiate_text" /> + android:paddingTop="40dp" + android:paddingLeft="20dp" + android:divider="@null" + android:id="@+id/listview_group" + android:textSize="16sp" + android:textColor="#ff000000" + android:shadowDx="4" + android:shadowDy="4" + android:shadowRadius="2" + /> \ No newline at end of file diff --git a/app/src/main/res/layout/list_view.xml b/app/src/main/res/layout/list_view.xml new file mode 100644 index 0000000..82a820f --- /dev/null +++ b/app/src/main/res/layout/list_view.xml @@ -0,0 +1,12 @@ + + diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index e9626cc..04c9088 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -33,4 +33,8 @@ #33CCCCCC + #FF1493 + #3CB371 + #FFD700 + \ No newline at end of file