Tag: android widget

适用于listview的自定义布局的适配器

我正在开发一个android项目,我必须从String数组(比如title,description,id)加载到listview项TextView。 我使用像这样的游标对数据库进行了类似的操作 String[] from = new String[]{“medicine”,”healthsystem”}; int[] to = new int[] {R.id.textlist1,R.id.textlist2}; // Now creating an array adapter and set it to display using my row SimpleCursorAdapter notes =new SimpleCursorAdapter(this,R.layout.notes_row, c, from, to); 我列出了“from”中的所有目标以及“to”中的所有目标。 现在我的问题是我没有数据库所以不能使用游标。 我有3个字符串数组,我想加载到每个项目的textviews(标题,描述,id) 怎么做请帮助我谢谢你:)

TextView Android里面的可点击单词

我有一个包含主题标签的textview。 #first #second #third 。 我的问题是如何检测单击哪个#标签,以便我可以执行某些操作 – 例如。 做这个词的祝酒词。 这可能使用TextView小部件吗? 我应该使用其他一些小部件吗? UPDATE 我用这个例子找到了我的解决方案。 希望将来能帮助别人!

使用LinearLayout和Java中的TextView更改颜色(Android)

我是一个相对较新的Android开发人员,我注意到对我来说似乎很奇怪,我希望有人可以解释。 我有LinearLayout ll。 这行代码在执行时失败了: ll.setBackgroundColor(R.color.white); 但是这行代码有效: ll.setBackgroundResource(R.color.white); 我假设它只是因为我的资源中定义了白色。 但是,我也尝试在setBackgroundColor()中传递0xFFFFFF,但这也不起作用。 与我的TextView文本类似,这行代码在执行时失败: text.setTextColor(R.color.white); 我可以看到我的TextView所以我知道我正确地初始化它(就像我的LinearLayout,我也可以看到)。 所以我想我的问题归结为:我如何正确使用LinearLayout.setBackgroundColor()和TextView.setTextColor()? 非常感谢提前。 我已经阅读了文档并尝试通过谷歌搜索在线查找信息,但没有提出任何建议。

根据城市,邮编或街道名称获取纬度和经度

在我当前的Android应用程序中,我想根据输入的城市名称,街道名称或邮政编码获取地理坐标。 我怎么能做到这一点? 最诚挚的问候,Rony

如何在android中每5秒调用一次方法?

我正在使用一个应用程序,当我选择时,它必须每隔5秒向服务器发送一个GPS位置(自动发送按钮)。 我是android的新手,所以我不知道如何制作开/关按钮,如何在按钮打开时调用每5秒发送一次数据的方法。 它必须每5秒调用一次的方法: public void postData() throws ClientProtocolException, IOException, Exception { String longitude=”UK”; String latitude=”UK”; String altitiude=”UK”; String time=””; String speed=””; getCurrentLocation(); // gets the current location and update mobileLocation variables if (mobileLocation != null) { locManager.removeUpdates(locListener); // This needs to stop getting the location data and save the battery power. longitude = “”+mobileLocation.getLongitude(); latitude […]