Wednesday, February 12, 2014

linearlayout background white, but gray font elements


            
I need to get a white background and black fonts, but found that as the title says, the specific layout as follows:
 

android: layout_width = "fill_parent"
android: layout_height = "fill_parent"
android: background = "# FFFFFF"
android: orientation = "vertical">

android: layout_width = "fill_parent"
android: layout_height = "50dip"
android: layout_marginLeft = "5dip"
android: layout_marginRight = "5dip"
android: layout_marginTop = "5dip">

android: id = "@ + id / searchBtn"
android: layout_width = "50dip"
android: layout_height = "fill_parent"
android: layout_alignParentRight = "true"
android: scaleType = "centerInside"
android: src = "@ drawable / search" />

android: id = "@ + id / searchText"
android: layout_width = "fill_parent"
android: layout_height = "fill_parent"
android: layout_marginRight = "0dip"
android: layout_toLeftOf = "@ id / searchBtn"
android: focusable = "true"
android: focusableInTouchMode = "true"
android: hint = "Please enter the keyword"
android: selectAllOnFocus = "true"
android: singleLine = "true" />


android: id = "@ + id / searchList"
android: layout_width = "fill_parent"
android: layout_height = "fill_parent"
android: cacheColorHint = "# 00000000" />



Found EditText and ListView font gray instead of black I want, if I remove the LinearLayout android: background = "# FFFFFF", where the current theme AppTheme, black background. How to solve to get what I want black font?
Reply:
The reply was deleted administrator at 2013-11-26 10:28:57

Reply:
The reply was deleted administrator at 2013-11-26 11:15:44

Reply:
android: hint = "Please enter the keyword"
android: cacheColorHint = "# 00000000" you set the default is gray hint
Reply:
EditText then use textcolor = "# 000000"
ListView, then it can not directly set the font color, it displays the contents of the adapter is set up in the
Reply:
android: cacheColorHint = "# 00000000" This property looks set translucent color does not matter and the word
Reply:
references, 4th Floor pengguohua1988 reply:
EditText then use textcolor = "# 000000"
ListView, then it can not directly set the font color, it shows the contents set in the adapter in

EditText I used textcolor = "# 000000", but still gray. I guess EditText and ListView font is really black, but for some reason could not display black, only show gray.
Reply:
reference to the 6th floor FakeDream reply:
Quote: references to the 4th floor pengguohua1988 reply:

EditText then use textcolor = "# 000000"
ListView, then it can not directly set the font color, it shows the contents set in the adapter in

EditText I used textcolor = "# 000000", but still gray. I guess EditText and ListView font is really black, but for some reason could not display black, only show gray.



You set the android: hint = "Please enter the keyword" So when the initial state "Please enter the keyword" these words are gray, when you enter text when displayed in black, the default text disappears. Fill in your ListView where the contents, paste it!
Reply:
reference to the 7th floor pengguohua1988 reply:
Quote: references to the 6th floor FakeDream reply:

Quote: references to the 4th floor pengguohua1988 reply:

EditText then use textcolor = "# 000000"
ListView, then it can not directly set the font color, it shows the contents set in the adapter in

EditText I used textcolor = "# 000000", but still gray. I guess EditText and ListView font is really black, but for some reason could not display black, only show gray.



You set the android: hint = "Please enter the keyword" So when the initial state "Please enter the keyword" these words are gray, when you enter text when displayed in black, the default text disappears. Fill in your ListView where the contents, paste it!

I mean, when you enter text is also gray, content ListView can not see, not very convenient content posted, sorry, anyway, are gray.
Reply:
references, 4th Floor pengguohua1988 reply:
EditText then use textcolor = "# 000000"
ListView, then it can not directly set the font color, it shows the contents set in the adapter in
Thank you for reminding me, I try to change the next.
Reply:
reference to the 9th floor FakeDream reply:
Quote: references to the 4th floor pengguohua1988 reply:

EditText then use textcolor = "# 000000"
ListView, then it can not directly set the font color, it shows the contents set in the adapter in
Thank you for reminding me, I try to change the next.
No, this property is not affected.
Reply:
reference to the 10th floor FakeDream reply:
Quote: references to the 9th floor FakeDream reply:

Quote: references to the 4th floor pengguohua1988 reply:

EditText then use textcolor = "# 000000"
ListView, then it can not directly set the font color, it shows the contents set in the adapter in
Thank you for reminding me, I try to change the next.
No, this property is not affected.

Can be posted under the appropriate interface code, for now it can not see the layout you say this situation, in particular as well as the corresponding ListView layout
Reply:
references, 4th Floor pengguohua1988 reply:
EditText then use textcolor = "# 000000"
ListView, we can not directly set the font color of it, the content it displays is set in the adapter in
EditText set textColor like, is black, but obviously the background is really too bright, even EditText border are invisible.
Reply:
reference to the 12th floor FakeDream reply:
Quote: references to the 4th floor pengguohua1988 reply:

EditText then use textcolor = "# 000000"
ListView, we can not directly set the font color of it, the content it displays is set in the adapter in
EditText set textColor like, is black, but obviously the background is really too bright, even EditText border are invisible.



You are now a pure white background, you can ask artists to give a color value
Reply:
 
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 {
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 ("Searching ...");
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 titlesList = bundle.getStringArrayList ("d_title");
ArrayList timesList = bundle.getStringArrayList ("sendtime");
ArrayList > items = new ArrayList > ();
int count = titlesList.size ();
for (int index = 0; index HashMap item = new HashMap ();
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 idsList = (HashMap ) 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);
}
}
}


Reply:
R.layout.search_listitem:

 

android: layout_width = "fill_parent"
android: layout_height = "50dip"
android: minHeight = "50dip"
android: orientation = "horizontal">

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 = "No Content"
android: singleLine = "true"
android: textSize = "15sp" />

android: id = "@ + id / sendtime"
android: layout_width = "0dip"
android: layout_height = "fill_parent"
android: layout_weight = "3"
android: gravity = "center"
android: hint = "No Content"
android: singleLine = "true"
android: textSize = "12sp" />



Reply:
I also posted the relevant xml under it:

style of:



<-!
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res / values-vXX / styles.xml on newer devices.

->


<-! Application theme -.>


<-! Definitions MainActivity in ActionBar theme ->





<-! Definitions MainActivity topics in ActionBar end ->


<-! Defined DetailActivity theme ->


<-! Defined IntroductionActivity theme ->


<-! Defined SearchActivity theme ->



Reply:
cited 15 floor FakeDream reply:
R.layout.search_listitem:

 

android: layout_width = "fill_parent"
android: layout_height = "50dip"
android: minHeight = "50dip"
android: orientation = "horizontal">

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 = "No Content"
android: singleLine = "true"
android: textSize = "15sp" />

android: id = "@ + id / sendtime"
android: layout_width = "0dip"
android: layout_height = "fill_parent"
android: layout_weight = "3"
android: gravity = "center"
android: hint = "No Content"
android: singleLine = "true"
android: textSize = "12sp" />




This is where there is no textcolor ah
Reply:

cited 17 floor pengguohua1988 reply:
Quote: 15th Floor FakeDream cited reply:

R.layout.search_listitem:

 

android: layout_width = "fill_parent"
android: layout_height = "50dip"
android: minHeight = "50dip"
android: orientation = "horizontal">

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 = "No Content"
android: singleLine = "true"
android: textSize = "15sp" />

android: id = "@ + id / sendtime"
android: layout_width = "0dip"
android: layout_height = "fill_parent"
android: layout_weight = "3"
android: gravity = "center"
android: hint = "No Content"
android: singleLine = "true"
android: textSize = "12sp" />




This is where there is no textcolor ah
You can set textcolor black, but the overall feeling is very bright, I guess the style set inside there is a problem which is estimated to inherit parent style.
Reply:
Indeed the style of the problem, as long succession @ style / Theme.Sherlock.Light on it, as follows:

 



Results posted, pure scattered points
Reply:
cited 19th floor FakeDream reply:
style is really a problem, as long as the inheritance @ style / Theme.Sherlock.Light on it, the following:

 



Results posted, pure scattered points
< / fieldset>

Posted a little more than the next posting .....
Reply:
cited 19th floor FakeDream reply:
style is really a problem, as long as the inheritance @ style / Theme.Sherlock.Light on it, the following:

 



Results posted, pure scattered points
< / fieldset>

Talk your style inside true useful?
Reply:
cited 20 floor pengguohua1988 reply:
Quote: 19th Floor FakeDream cited reply:

Indeed the style of the problem, as long succession @ style / Theme.Sherlock.Light on it, as follows:

 



Results posted, pure scattered points
< / fieldset>

Posted a little more than the next posting .....

Reply:
cited 21 floor pengguohua1988 reply:
Quote: 19th Floor FakeDream cited reply:

Indeed the style of the problem, as long succession @ style / Theme.Sherlock.Light on it, as follows:

 



Results posted, pure scattered points
< / fieldset>

Talk your style inside true useful?
Useful ah.
Reply:
cited 23 floor FakeDream reply:
Quote: references 21 F pengguohua1988 reply:

Quote: 19th Floor FakeDream cited reply:

Indeed the style of the problem, as long succession @ style / Theme.Sherlock.Light on it, as follows:

 



Results posted, pure scattered points
< / fieldset>

Talk your style inside true useful?
Useful ah.


true I only used this
Reply:
cited 23 floor FakeDream reply:
Quote: references 21 F pengguohua1988 reply:

Quote: 19th Floor FakeDream cited reply:

Indeed the style of the problem, as long succession @ style / Theme.Sherlock.Light on it, as follows:

 



Results posted, pure scattered points
< / fieldset>

Talk your style inside true useful?
Useful ah.
... should think about useless, and I did not inherit Sherlock Activity

No comments:

Post a Comment