I would like to set a certain Drawable
as the device's wallpaper, but all wallpaper functions accept Bitmap
s only. I cannot use WallpaperManager
because I'm pre 2.1.
Also, my drawables are downloaded from the web and do not reside in R.drawable
.
My app shows a list of 9 categories and each category displays a Gallery-based coverflow (graciously offered by Neil Davies here) with images of the selected category.
The images are fetched from the Web, each ranging from 300K to 500K in size, and stored in an arrayList of Drawables. This data is bound to the coverflow using a BaseAdapter (code below).
Every time I exit the coverflow and go back to the list of categories, I clear the arrayList …
我有一个附加到AutoCompleteTextView(textView)组件的ArrayAdapter(myAdapter).
一旦用户按下一个字符,我想用包含该字符的项目填充AutoCompleteTextView的下拉列表.
我使用AsyncTask(使用Web服务)检索项目.
我调用myAdapter.add(item)但下拉列表为空.
我在每次添加后添加了一个调用myAdapter.getCount(),每次都显示为零.调用notifyDataSetChanged()没有帮助.
我甚至试图添加简单的String对象而不是我的自定义对象,但无济于事.
我究竟做错了什么?
编辑:我改变了代码,因为miette建议如下,但仍无济于事.
通常,我所做的是在自动完成文本视图中更改文本后,我调用一个新的AsyncTask并将输入的文本和Handler传递给它(请参阅afterTextChanged()).该任务检索与文本相关的对象,一旦完成Handler的handleMessage()被调用.在handleMessage()中,我尝试填充适配器的对象.但仍然适配器的下拉列表结束为空.
这是我的代码:
public class AddStockView extends Activity
implements OnClickListener, OnItemClickListener, TextWatcher {
ArrayAdapter<Stock> adapter;
AutoCompleteTextView textView;
Vector<Stock> stocks;
public AddStockView() {
// TODO Auto-generated constructor stub
stocks = new Vector<Stock>();
}
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.add_stock_view);
findViewById(R.id.abort_button).setOnClickListener(this);
adapter = new ArrayAdapter<Stock>(this,
android.R.layout.simple_dropdown_item_1line, stocks);
//adapter.setNotifyOnChange(true);
textView = (AutoCompleteTextView)
findViewById(R.id.search_edit_text);
textView.setAdapter(adapter);
textView.setOnItemClickListener(this);
textView.addTextChangedListener(this);
}
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
switch (v.getId())
{
case R.id.abort_button: …
Run Code Online (Sandbox Code Playgroud) 我的应用程序显示来自Web服务的希伯来语文本.
当一个句子包含数字(在它的中间)时,数字出现在镜像视图中:
29显示为92,21 :45显示为54:12,2,000显示为000,2.
此外,当一个句子以数字或英文字符开头时,它们会被抛到句子的末尾,弄乱它...
有谁知道如何解决这个问题?Android中的RTL支持还不成熟吗?
我已经回顾了一些有关延迟加载的帖子,但我相信我的问题有点不同.
我有一个画廊(我的班级扩展画廊),它显示了20个相当大的图像(每个400-500K).我无法将它们全部加载到库中,因为我得到了OutOfMemory异常.
所以,我创建了一个包含20个Drawables的数组,最初填充了前9个元素(图像来自Web)并将所有其余元素设置为null.我的意图是这样的:向右倾斜,获取元素号.10并设置为null元素号.在另一个fling到右边的fetch元素没有.11并设置为null元素号.1到null.抛弃左边的逻辑相同.
问题是我可以比获取元素快得多.我的画廊有一个BaseAdapter,它的getView()看起来像这样:
public View getView(int position, View convertView, ViewGroup parent){ ImageView imageView = new ImageView(); imageView.setDrawable(imageArray[position]; .... .... return imageView; }
我怎么告诉getView() - 如果imageArray [position]仍然为null,显示一个"loading ..."对话框,一旦设置,重复自己的位置相同?
我不想看到imageView为空,然后动态设置.我希望在设置之前根本看不到imageView.
谢谢.
我想在点击时显示/隐藏操作栏.
它确实显示和隐藏但它并不平滑......底部隐藏但不同的背景在消失之前一段时间.
我甚至在一个简单的hello world应用程序中尝试过,结果是一样的.这是代码:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
TextView tv = (TextView) findViewById(R.id.shit);
tv.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
getActionBar().hide();
}
});
}
Run Code Online (Sandbox Code Playgroud) android ×6
bitmap ×1
gallery ×1
hebrew ×1
lazy-loading ×1
memory-leaks ×1
show-hide ×1
wallpaper ×1