Igo*_*pov 6 android android-layout
乡亲!我需要做这样的布局:我有listview,我需要把按钮放在它的顶部和底部,即当用户滚动列表到最后,他可以看到底部按钮,当用户在顶部时列表,他可以看到顶部按钮.但是当用户处于listview的"中间"时,他看不到这些按钮.我不知道该怎么做.感谢帮助.
UPDATE
listView=(ListView)findViewById(R.id.listSearchResults);
LayoutInflater inflater=this.getLayoutInflater();
View header=inflater.inflate(R.layout.list_header, null);
btnBack=(Button)header.findViewById(R.id.btnBack);
btnBack.setOnClickListener(this);
btnBack.setEnabled(false);
listView.addHeaderView(header);
View footer=inflater.inflate(R.layout.list_footer, null);
btnForward=(Button)footer.findViewById(R.id.btnForward);
btnForward.setOnClickListener(this);
btnForward.setEnabled(false);
listView.addFooterView(footer);
Run Code Online (Sandbox Code Playgroud)
Nir*_*tel 32
首先创建两个布局文件.像footer_layout.xml&header_layout.xml一样在列表视图中添加footerview-headerview
LayoutInflater inflater = activity.getLayoutInflater();
LinearLayout listFooterView = (LinearLayout)inflater.inflate(
R.layout.footer_layout, null);
list.addFooterView(listFooterView);
LinearLayout listHeaderView = (LinearLayout)inflater.inflate(
R.layout.header_layout, null);
list.addHeaderView(listHeaderView);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
29322 次 |
| 最近记录: |