手机怎样制作表格表格?

android 头行列可固定的表格制作
在android中我们平日经常用listview、gridview控件来制作数据不固定的表格,一般都是头列表格头固定,底下listview展示可变数据,然而在工作中我碰到了一个需求:上下滑动时头列固定,左右滑动时头行固定的,流量了很多网站都没有找到合适的,于是自己想了一个解决方案。
马上上效果图,有这个效果需要的同仁继续往下看
我们看到的效果好像是一个既可以左右滑动又能上下滑动的ListView,其实不然,这个要用单纯的一个ListView或者ScrollView实现非常困难,所以我选择了把它们组合起来,组合方式如下:
最左上角的TextView是不动的,当左右滑动时候,第一列固定,右边上下两个ScrollView实现联动;当上下滑动时,头部第一行不动,下面两个ListView实现联动就行了。
3、代码实现
首先是主界面的布局:avtivity_main
由于头部标题的ScrollView一般是不能去主动滑动的,所以要拦截掉ScrollView的touch事件,代码详细大家都懂,这里为了方便一并附出:
package com.lunge.mydifdirtable.
import android.content.C
import android.util.AttributeS
import android.view.MotionE
import android.widget.HorizontalScrollV
* Created by Binglun on 7/13
public class NoScrollHorizontalScrollView extends HorizontalScrollView {
public NoScrollHorizontalScrollView(Context context) {
super(context);
public NoScrollHorizontalScrollView(Context context, AttributeSet attrs) {
super(context, attrs);
public NoScrollHorizontalScrollView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
public boolean onInterceptHoverEvent(MotionEvent event) {
public boolean dispatchTouchEvent(MotionEvent ev) {
return super.dispatchTouchEvent(ev);
public boolean onTouchEvent(MotionEvent ev) {
看到这里,大家就明白当左右滑动时,是下面的ScrollView带着上面的ScrollView一起滑动的,实现方式是再自定义一个ScrollView,用监听者模式,在自己滑动的回调代码里onScrollStateChange,调用顶部ScrollView的onScroll方法,实现同步滑动;代码如下:
package com.lunge.mydifdirtable.
import android.content.C
import android.util.AttributeS
import android.widget.HorizontalScrollV
* Created by Lunger on 7/11
public class LinkedHorizontalScrollView extends HorizontalScrollView {
private LinkScrollChangeL
public LinkedHorizontalScrollView(Context context) {
super(context);
public LinkedHorizontalScrollView(Context context, AttributeSet attrs) {
super(context, attrs);
public LinkedHorizontalScrollView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
public void setMyScrollChangeListener(LinkScrollChangeListener listener){
this.listener =
protected void onScrollChanged(int l, int t, int oldl, int oldt) {
super.onScrollChanged(l, t, oldl, oldt);
if(null != listener)
listener.onscroll(this, l, t, oldl, oldt);
* 控制滑动速度
public void fling(int velocityY) {
super.fling(velocityY / 2);
interface LinkScrollChangeListener {
void onscroll(LinkedHorizontalScrollView view, int l, int t, int oldl, int oldt);
控件都已经介绍完了,接下来就是主界面的程序:
package com.lunge.
import android.os.B
import android.support.v7.app.AppCompatA
import android.view.V
import android.widget.AbsListV
import android.widget.HorizontalScrollV
import android.widget.ListV
import com.lunge.mydifdirtable.adapter.LvInfoA
import com.lunge.mydifdirtable.adapter.LvNameA
import com.lunge.mydifdirtable.view.LinkedHorizontalScrollV
import com.lunge.mydifdirtable.view.NoScrollHorizontalScrollV
public class MainActivity extends AppCompatActivity {
private NoScrollHorizontalScrollView sv_normalgoods_//不可滑动的顶部左侧的ScrollView
private LinkedHorizontalScrollView sv_normalgoods_//底部左侧的ScrollView
private ListView lv_//底部左侧的ListView
private ListView lv_normalgood_//底部右侧的ListView
boolean isLeftListEnabled =
boolean isRightListEnabled =
private LvNameAdapter mLvNormalNameA
private LvInfoAdapter mLvNormalInfoA
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
initView();
initAdapter();
private void initView() {
sv_normalgoods_title = (NoScrollHorizontalScrollView)findViewById(R.id.sv_title);
sv_normalgoods_detail = (LinkedHorizontalScrollView)findViewById(R.id.sv_good_detail);
lv_normalgoodname = (ListView) findViewById(R.id.lv_goodname);
lv_normalgood_info = (ListView)findViewById(R.id.lv_good_info);
combination(lv_normalgoodname, lv_normalgood_info, sv_normalgoods_title, sv_normalgoods_detail);
private void initAdapter() {
mLvNormalNameAdapter = new LvNameAdapter(this);
mLvNormalInfoAdapter = new LvInfoAdapter(this);
lv_normalgoodname.setAdapter(mLvNormalNameAdapter);
lv_normalgood_info.setAdapter(mLvNormalInfoAdapter);
private void combination(final ListView lvName, final ListView lvDetail, final HorizontalScrollView title, LinkedHorizontalScrollView content) {
* 左右滑动同步
content.setMyScrollChangeListener(new LinkedHorizontalScrollView.LinkScrollChangeListener() {
public void onscroll(LinkedHorizontalScrollView view, int x, int y, int oldx, int oldy) {
title.scrollTo(x, y);
* 上下滑动同步
// 禁止快速滑动
lvName.setOverScrollMode(ListView.OVER_SCROLL_NEVER);
lvDetail.setOverScrollMode(ListView.OVER_SCROLL_NEVER);
//左侧ListView滚动时,控制右侧ListView滚动
lvName.setOnScrollListener(new AbsListView.OnScrollListener() {
public void onScrollStateChanged(AbsListView view, int scrollState) {
//这两个enable标志位是为了避免死循环
if (scrollState == SCROLL_STATE_TOUCH_SCROLL) {
isRightListEnabled =
isLeftListEnabled =
} else if (scrollState == SCROLL_STATE_IDLE) {
isRightListEnabled =
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount,
int totalItemCount) {
View child = view.getChildAt(0);
if (child != null && isLeftListEnabled) {
lvDetail.setSelectionFromTop(firstVisibleItem, child.getTop());
//右侧ListView滚动时,控制左侧ListView滚动
lvDetail.setOnScrollListener(new AbsListView.OnScrollListener() {
public void onScrollStateChanged(AbsListView view, int scrollState) {
if (scrollState == SCROLL_STATE_TOUCH_SCROLL) {
isLeftListEnabled =
isRightListEnabled =
} else if (scrollState == SCROLL_STATE_IDLE) {
isLeftListEnabled =
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount,
int totalItemCount) {
View c = view.getChildAt(0);
if (c != null && isRightListEnabled) {
lvName.setSelectionFromTop(firstVisibleItem, c.getTop());
代码不多也比较容易理解,这里就不多述。就介绍到此;
等等,博主,里面的adapter代码呢???
这也要附啊,好吧:
LvNameAdapter:
package com.lunge.mydifdirtable.
import android.content.C
import android.view.LayoutI
import android.view.V
import android.view.ViewG
import android.widget.BaseA
import android.widget.TextV
import com.lunge.mydifdirtable.R;
* Created by Binglun on 7/13
public class LvNameAdapter extends BaseAdapter {
public LvNameAdapter(Context context) {
this.context =
public int getCount() {
return 100;
public Object getItem(int position) {
public long getItemId(int position) {
public View getView(int position, View convertView, ViewGroup parent) {
if(convertView == null){
holder = new ViewHolder();
convertView = LayoutInflater.from(context).inflate(R.layout.item_lv_good_name, null);
holder.tv_goodname = (TextView) convertView.findViewById(R.id.tv_name);
convertView.setTag(holder);
holder = (ViewHolder) convertView.getTag();
holder.tv_goodname.setText(&iPone& + (position+4) + &s&);
return convertV
class ViewHolder{
TextView tv_
对应布局文件:
LvInfoAdapter:
package com.lunge.mydifdirtable.
import android.content.C
import android.view.LayoutI
import android.view.V
import android.view.ViewG
import android.widget.BaseA
import android.widget.ImageV
import android.widget.TextV
import com.lunge.mydifdirtable.R;
* Created by Lunger on 7/13
public class LvInfoAdapter extends BaseAdapter {
public LvInfoAdapter(Context context) {
this.context =
public int getCount() {
return 100;
public Object getItem(int position) {
public long getItemId(int position) {
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null) {
holder = new ViewHolder();
convertView = LayoutInflater.from(context).inflate(R.layout.item_lv_good_info, null);
holder.tv_barcode = (TextView) convertView.findViewById(R.id.tv_barcode);
holder.tv_category = (TextView) convertView.findViewById(R.id.tv_category);
holder.tv_spec = (TextView) convertView.findViewById(R.id.tv_spec);
holder.tv_unit = (TextView) convertView.findViewById(R.id.tv_unit);
holder.tv_supplyer = (TextView) convertView.findViewById(R.id.tv_supplyer);
holder.tv_sale_money = (TextView) convertView.findViewById(R.id.tv_sale_money);
holder.tv_income_money = (TextView) convertView.findViewById(R.id.tv_income_money);
holder.tv_keep = (TextView) convertView.findViewById(R.id.tv_keep);
holder.tv_intime = (TextView) convertView.findViewById(R.id.tv_intime);
holder.tv_online = (ImageView) convertView.findViewById(R.id.iv_online);
convertView.setTag(holder);
holder = (ViewHolder) convertView.getTag();
if (position & 10) {
holder.tv_barcode.setText(&& + position);
holder.tv_barcode.setText(&& + position);
holder.tv_category.setText(&类型& + position);
holder.tv_spec.setText(&规格& + position);
holder.tv_unit.setText(&个&);
holder.tv_supplyer.setText(&供应商& + position);
holder.tv_sale_money.setText(&价格& + position);
holder.tv_keep.setText(&1年&);
holder.tv_intime.setText(&&);
holder.tv_income_money.setText(&进货价& + position);
return convertV
class ViewHolder {
TextView tv_
TextView tv_
TextView tv_
TextView tv_
TextView tv_
TextView tv_sale_
TextView tv_income_
TextView tv_
TextView tv_
ImageView tv_
对应布局文件:
(window.slotbydup=window.slotbydup || []).push({
id: '2467140',
container: s,
size: '1000,90',
display: 'inlay-fix'
(window.slotbydup=window.slotbydup || []).push({
id: '2467141',
container: s,
size: '1000,90',
display: 'inlay-fix'
(window.slotbydup=window.slotbydup || []).push({
id: '2467142',
container: s,
size: '1000,90',
display: 'inlay-fix'
(window.slotbydup=window.slotbydup || []).push({
id: '2467143',
container: s,
size: '1000,90',
display: 'inlay-fix'
(window.slotbydup=window.slotbydup || []).push({
id: '2467148',
container: s,
size: '1000,90',
display: 'inlay-fix'如何使用手机wps绘制表格_WPS表格教程
如何使用手机wps绘制表格
学习啦【WPS表格教程】 编辑:德南
  我们有时需要在w中绘制,而身边没有,怎么办?这时我们可以使用手机版本的wps绘制表格,下面就让学习啦小编告诉你 如何使用手机wps绘制表格的方法。
  使用手机wps绘制表格的方法:
  点击手机中软件,一般手机都自带该软件,没有的话,可以下载一个,方便以后使用。一般出现的是最近查看的文档,点击下方第三个按钮,即&新建&按钮:
  我们要制作表格,因此,点击中间的&表格&图标。
  你可以开始编辑表格,和常用工具都在下方的菜单中,比较容易找到和操作。
  好以后,点击左上角的像软盘的图标,即保存图标。
  手机屏幕将出现以下画面,让你选择文件保存的位置,比如我们选择第一个&我的文档&。
  则屏幕出现如图画面,系统默认的保存名称是工作簿,你可以自行修改保存。名字改好后,点击右下角的&保存&按键即可。有网络的话,可以直接发送给别人了!
看了如何使用手机wps绘制表格的人还看:
本文已影响 人
[如何使用手机wps绘制表格]相关的文章
看过本文的人还看了
18362人看了觉得好
1439人看了觉得好
1283人看了觉得好
【WPS表格教程】图文推荐
Copyright & 2006 -
All Rights Reserved
学习啦 版权所有Quick Office怎么用 手机Excel(处理表格/图形分析)教程
作者:佚名
字体:[ ] 来源:互联网 时间:04-09 10:55:46
Quick office就是手机端的移动办公软件的佼佼者,Excel是办公室自动化中非常重要的一款软件,它不仅仅能够方便的处理表格和进行图形分析,其更强大的功能体现在对数据的自动处理和计算
&我们工作、生活、学习处处都离不开移动办公。虽然手机端的移动办公软件没有电脑端的那么强大,但却极大的方便了我们随时随地的处理文档。Quick office又是其中的佼佼者。用户安装Quick office后注意:如果安装后运行提示注册,随便输入一个电子邮箱的地址注册即可,或者打上&不再询问&的勾勾后点击以后注册。
Quick Office快捷办公
新版的Quick office同时兼容了03、07和10版的office excel。Quick office优化了程序引擎,在打开及保存excel时的速度变得更快。如下图可以看出,不同于word文档,excel在横屏下更直观、方便使用。
插入行、插入列、添加链接和剪切复制这些基本的功能也在Quick office上一应俱全。
做Excel表格经常要用到搜索、替换,达到快速处理的目的。在菜单栏中选择搜索就会在屏幕上方显示搜索栏。输入文字进行搜索,Excel表格里就会自动跳转到该文字栏。很容易被用户忽略的就是长按左边的数字栏可以对单元行进行放大或缩小。放大或缩小的时候会有一条虚线标记。
令人遗憾的是这款软件中Excel的功能中并没有加入函数Quick Office 快捷办公&Excel使用教程算法。比如自动加法,小编选取了一组数字想要把这组数字自动用加法加好,无论是菜单栏中,还是长按选中的这些列都只有显示剪切或者复制。小编再用ipad试了一下,结果还是没有。
软件还支持查看文件属性,属性上会显示Excel表格的名字、大小、修改时间还有作者。
Excel是办公室自动化中非常重要的一款软件,它不仅仅能够方便的处理表格和进行图形分析,其更强大的功能体现在对数据的自动处理和计算。如果一款Excel软件没有了这些自动处理和计算能力,不得不说是一个致命硬伤。
大家感兴趣的内容
12345678910
最近更新的内容

我要回帖

更多关于 手机word制作表格 的文章

 

随机推荐