目标:实现HappyIdiom Study界面的设计
study_item.xml文件:布局List中的每一项
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:paddingBottom="1dip"
android:paddingLeft="10dip"
android:paddingRight="10dip"
android:paddingTop="1dip" >
<ImageView
android:id="@+id/image"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/introduction"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:textColor="#000000"
android:textSize="25sp" />
</LinearLayout>
StudyActivity:分类列表页面
public class StudyActivity extends ListActivity {
List<Map<String, Object>> data;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_study);
getData();
SimpleAdapter simpleAdapter = new SimpleAdapter(this, data,
R.layout.study_item, new String[] { "image", "introduction"},
new int[] { R.id.image, R.id.introduction });
setListAdapter(simpleAdapter);
}
private void getData() {
data = new ArrayList<Map<String, Object>>();
int[] images = new int[] { R.drawable.study_animal,
R.drawable.study_human, R.drawable.study_season,
R.drawable.study_nature, R.drawable.study_number,
R.drawable.study_fable, R.drawable.study_different,
R.drawable.study_other };
int[] choices = new int[] { R.string.animal, R.string.human,
R.string.season, R.string.nature, R.string.number,
R.string.fable, R.string.different, R.string.other };
for (int i = 0; i < images.length; i++) {
Map<String, Object> map = new HashMap<String, Object>();
map.put("image", images[i]);
map.put("introduction", getString(choices[i]));
data.add(map);
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.activity_study, menu);
return true;
}
}
问题:当设计完成这个页面时,标题栏滚动字幕不滚动了,大家可以一起来分析一下原因所在?