嘿,我想为我的应用程序创建一个这样的布局。当然,功能会有所不同。我正在研究这方面的源代码,我找到了做这件事的xml文件。我只是不知道如何在活动中实现它,如何调用,创建什么,列表视图,等等。

我的意思是,我只想用较大的字体列出名称和日期,如图所示,字体较小,但靠右对齐。
因为,我想从我创建的数据库中获取数据,并像下面的CallLog列表那样打印它。
我的意思是,Android如何让图标的日期在右边对齐,字体很小?
这就是我的活动,我只是不知道要使用源代码中的哪个xml文件,也不知道要实现什么方法才能像图像示例那样打印数据。
public class RatedCalls extends ListActivity {
private static final String LOG_TAG = "RatedCalls";
private TableLayout table;
private CallDataHelper cdh;
private TableRow row;
private TableRow row2;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.recent_calls);
Log.i(LOG_TAG, "calling from onCreate()");
cdh = new CallDataHelper(this);
startService(new Intent(this, RatedCallsService.class));
Log.i(LOG_TAG, "Service called.");
Log.i(LOG_TAG, "before call fillList");
/*
* mAdapter = new RecentCallsAdapter();
* getListView().setOnCreateContextMenuListener(this);
* setListAdapter(mAdapter);
*/
fillList();
Log.i(LOG_TAG, "after call fillList");
}
public void onResume() {
super.onResume();
fillList();
}
public void fillList() {
Log.i(LOG_TAG, "entered on fillList");
List<String> ratedCalls = new ArrayList<String>();
ratedCalls = this.cdh.selectTopCalls();
//setListAdapter(new ArrayAdapter<String>(this, R.layout.recent_calls_list_item,
//ratedCalls));
ListView lv = getListView();
lv.setTextFilterEnabled(true);
getListView().setOnCreateContextMenuListener(this);
lv.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
Toast.makeText(getApplicationContext(),
((TextView) view).getText(), Toast.LENGTH_LONG).show();
}
});
}
}谢谢。
发布于 2011-01-14 03:27:43
这只是一个两步的过程:
发布于 2011-01-14 03:13:13
我将创建一个包含多个文本视图的列表视图。
https://stackoverflow.com/questions/4683416
复制相似问题