我看网上说用HorizontalScrollView,我也用了,但还是显示的是竖直的,刚玩android,就连受打击,求高手知道
xml布局
<HorizontalScrollView
android:layout_width="wrap_content"
android:layout_height="97dp"
>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<ListView
android:id="@+id/ziofthiscontent"
android:layout_width="wrap_content"
android:layout_height="97dp">
</ListView>
</LinearLayout>
</HorizontalScrollView>
java代码
ArrayList<HashMap<String,Object>> content =new ArrayList<HashMap<String,Object>>();
for(int i=0;i<zi_content.length;i++)
{
HashMap<String,Object> zi=new HashMap<String,Object>();
zi.put("zi", zi_content[i]);
content.add(zi);
}
SimpleAdapter adapter2=new SimpleAdapter(WritechineseActivity.this,content,R.layout.content_zi,new String[]{"zi"},new int[]{R.id.zi_button});
((ListView) findViewById(R.id.ziofthiscontent)).setAdapter(adapter2);
private String[] zi_content={"一","二","三","四","五","六","七","十","十一","十二","十三","十四","十五","十六","十七"};R.layout.content_zi的xml布局
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<Button
android:id="@+id/zi_button"
android:spacing="5dp"
android:background="@drawable/transparent"
android:textSize="25sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
/>
</LinearLayout>
小弟先谢谢各位了
xml布局
<HorizontalScrollView
android:layout_width="wrap_content"
android:layout_height="97dp"
>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<ListView
android:id="@+id/ziofthiscontent"
android:layout_width="wrap_content"
android:layout_height="97dp">
</ListView>
</LinearLayout>
</HorizontalScrollView>
java代码
ArrayList<HashMap<String,Object>> content =new ArrayList<HashMap<String,Object>>();
for(int i=0;i<zi_content.length;i++)
{
HashMap<String,Object> zi=new HashMap<String,Object>();
zi.put("zi", zi_content[i]);
content.add(zi);
}
SimpleAdapter adapter2=new SimpleAdapter(WritechineseActivity.this,content,R.layout.content_zi,new String[]{"zi"},new int[]{R.id.zi_button});
((ListView) findViewById(R.id.ziofthiscontent)).setAdapter(adapter2);
private String[] zi_content={"一","二","三","四","五","六","七","十","十一","十二","十三","十四","十五","十六","十七"};R.layout.content_zi的xml布局
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<Button
android:id="@+id/zi_button"
android:spacing="5dp"
android:background="@drawable/transparent"
android:textSize="25sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
/>
</LinearLayout>
小弟先谢谢各位了
解决方案 »
- 【求助】类似于QQ、微信之类的软件安装后第一次打开,功能介绍的图片切换效果该怎么做
- Android背景图片设置,菜鸟求救!
- sdcard/Android/data下的文件夹在程序安装完成如何自动创建?
- 新手求助:如何进入系统的通讯记录页面
- android:targetSdkVersion="19" 然后就获取不到连接了
- Android下的UDP传输协议问题
- 第三方应用分享视频到微信客户端
- 关于安卓应用的服务器端开发
- 求教:android开发旅游地图
- 第一次用androidstudio,请问这是什么错误,以前用eclipise没报过错
- ubuntu中 android源代码的使用求教
- HTC G14为什么收不到关机广播?
http://jameszhao84.iteye.com/blog/1395567
网页的附件里