嘿我想为我的应用程序创建这样的布局。当然,功能将是不同的。我正在研究这个的源代码,我找到了那样做的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 ratedCalls = new ArrayList();
ratedCalls = this.cdh.selectTopCalls();
//setListAdapter(new ArrayAdapter(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();
}
});
}
}
谢谢。