xml 相关的我也贴下吧:style的:<resources xmlns:android="http://schemas.android.com/apk/res/android"> <!-- Base application theme, dependent on API level. This theme is replaced by AppBaseTheme from res/values-vXX/styles.xml on newer devices.--> <style name="AppBaseTheme" parent="android:Theme.Light"> <!-- Theme customizations available in newer API levels can go in res/values-vXX/styles.xml, while customizations related to backward-compatibility can go here. --> </style> <!-- Application theme. --> <style name="AppTheme" parent="AppBaseTheme"> <!-- All customizations that are NOT specific to a particular API-level can go here. --> </style> <!-- 定义MainActivity中ActionBar的主题 --> <style name="MainActivityTheme" parent="@style/Theme.Sherlock.Light"> <item name="actionBarStyle">@style/my_actionbar_style</item> <item name="android:actionBarStyle">@style/my_actionbar_style</item> <item name="actionBarTabTextStyle">@style/custom_title_textsize</item> <item name="android:actionBarTabTextStyle">@style/custom_title_textsize</item> <item name="actionBarSize">48dip</item> <item name="android:actionBarSize">48dip</item> </style> <style name="my_actionbar_style" parent="@style/Widget.Sherlock.ActionBar"> <item name="background">@drawable/title_bg</item> <item name="android:background">@drawable/title_bg</item> </style> <style name="custom_title_textsize"> <item name="android:textSize">15sp</item> </style> <!-- 定义MainActivity中ActionBar的主题 结束 --> <!-- 定义DetailActivity的主题 --> <style name="DetailActivityTheme"> <item name="android:windowNoTitle">true</item> </style> <!-- 定义IntroductionActivity的主题 --> <style name="IntroductionActivityTheme"> <item name="android:windowNoTitle">true</item> </style> <!-- 定义SearchActivity的主题 --> <style name="SearchActivityTheme"> <item name="android:windowNoTitle">true</item> </style></resources>
ListView的话不能直接设置字体颜色吧,它显示的内容是在adapter中设置的
你设置了android:hint="请输入关键字"那么初始状态的时候"请输入关键字"这几个字是灰色的,当你输入文字的时候显示的为黑色,默认文字消失。你的ListView中填充的内容在哪,贴一下吧!
你设置了android:hint="请输入关键字"那么初始状态的时候"请输入关键字"这几个字是灰色的,当你输入文字的时候显示的为黑色,默认文字消失。你的ListView中填充的内容在哪,贴一下吧!
我的意思是输入文字时也是灰色的,ListView的内容可以不用看吧,内容不太方便贴,不好意思,反正都是灰色的。
package cn.gov.czsti;import java.util.ArrayList;
import java.util.HashMap;import com.example.czstiproject.R;import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Message;import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.AdapterView;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ListView;
import android.widget.SimpleAdapter;public class SearchActivity extends Activity {
private ListView list = null; @Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_search); final EditText edit = (EditText) findViewById(R.id.searchText); list = (ListView) findViewById(R.id.searchList); ImageButton btn = (ImageButton) findViewById(R.id.searchBtn);
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View source) {
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(edit.getWindowToken(), 0);
if (TextUtils.isEmpty(edit.getText().toString()))
list.setAdapter(null);
else
setListItems(edit.getText().toString().trim());
}
});
} private void setListItems(String keyword) {
requestTask task = new requestTask(this);
task.execute(keyword);
} class requestTask extends AsyncTask<String, Integer, Message> {
ProgressDialog dialog;
Context ctx; public requestTask(Context ctx) {
this.ctx = ctx;
} @Override
protected Message doInBackground(String... params) {
return new WebServiceClass().searchKeyword(params[0]);
} @Override
protected void onPreExecute() {
dialog = new ProgressDialog(ctx);
dialog.setIndeterminate(true);
dialog.setTitle("正在搜索...");
dialog.setCancelable(false);
dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
dialog.show();
} @Override
protected void onPostExecute(Message result) {
if (result == null || list == null)
return;
Bundle bundle = result.getData();
ArrayList<String> titlesList = bundle.getStringArrayList("d_title");
ArrayList<String> timesList = bundle.getStringArrayList("sendtime");
ArrayList<HashMap<String, String>> items = new ArrayList<HashMap<String, String>>();
int count = titlesList.size();
for (int index = 0; index < count; index++) {
HashMap<String, String> item = new HashMap<String, String>();
item.put("d_title", titlesList.get(index));
item.put("sendtime", timesList.get(index));
items.add(item);
}
SimpleAdapter adapter = new SimpleAdapter(SearchActivity.this,
items, R.layout.search_listitem, new String[] { "d_title",
"sendtime" },
new int[] { R.id.item, R.id.sendtime });
list.setAdapter(adapter);
final HashMap<Integer, Integer> idsList = (HashMap<Integer, Integer>) bundle
.getSerializable("id");
list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
Intent intent = new Intent(SearchActivity.this,
DetailActivity.class);
intent.putExtra("newsId", idsList.get(position));
intent.putExtra("requestSource", "SearchActivity");
startActivity(intent);
SearchActivity.this.overridePendingTransition(
R.anim.slide_in_right, R.anim.slide_out_left);
}
});
dialog.dismiss();
}
} @Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
startActivity(new Intent(SearchActivity.this, MainActivity.class));
finish();
overridePendingTransition(R.anim.slide_in_left,
R.anim.slide_out_right);
return true;
} else {
return super.onKeyDown(keyCode, event);
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="50dip"
android:minHeight="50dip"
android:orientation="horizontal" > <TextView
android:id="@+id/item"
android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_marginLeft="2dip"
android:layout_weight="7"
android:ellipsize="end"
android:gravity="left|center_vertical"
android:hint="无内容"
android:singleLine="true"
android:textSize="15sp" /> <TextView
android:id="@+id/sendtime"
android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_weight="3"
android:gravity="center"
android:hint="无内容"
android:singleLine="true"
android:textSize="12sp" /></LinearLayout>
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.-->
<style name="AppBaseTheme" parent="android:Theme.Light">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here. -->
</style> <!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. --> </style> <!-- 定义MainActivity中ActionBar的主题 -->
<style name="MainActivityTheme" parent="@style/Theme.Sherlock.Light">
<item name="actionBarStyle">@style/my_actionbar_style</item>
<item name="android:actionBarStyle">@style/my_actionbar_style</item>
<item name="actionBarTabTextStyle">@style/custom_title_textsize</item>
<item name="android:actionBarTabTextStyle">@style/custom_title_textsize</item>
<item name="actionBarSize">48dip</item>
<item name="android:actionBarSize">48dip</item>
</style> <style name="my_actionbar_style" parent="@style/Widget.Sherlock.ActionBar">
<item name="background">@drawable/title_bg</item>
<item name="android:background">@drawable/title_bg</item>
</style> <style name="custom_title_textsize">
<item name="android:textSize">15sp</item>
</style>
<!-- 定义MainActivity中ActionBar的主题 结束 -->
<!-- 定义DetailActivity的主题 -->
<style name="DetailActivityTheme">
<item name="android:windowNoTitle">true</item>
</style> <!-- 定义IntroductionActivity的主题 -->
<style name="IntroductionActivityTheme">
<item name="android:windowNoTitle">true</item>
</style> <!-- 定义SearchActivity的主题 -->
<style name="SearchActivityTheme">
<item name="android:windowNoTitle">true</item>
</style></resources>
这里也没有这是textcolor啊
<style name="SearchActivityTheme" parent="@style/Theme.Sherlock.Light">
<item name="windowNoTitle">true</item>
<item name="android:windowNoTitle">true</item>
</style>
结贴,纯散分
话说你style里面的<item name="windowNoTitle">true</item>有用吗?
话说你style里面的<item name="windowNoTitle">true</item>有用吗?有用啊。
话说你style里面的<item name="windowNoTitle">true</item>有用吗?有用啊。 <item name="android:windowNoTitle">true</item>我只用过这个
话说你style里面的<item name="windowNoTitle">true</item>有用吗?有用啊。...仔细想想应该没用,我的Activity又没有继承Sherlock