当前位置:  编程技术>移动开发
本页文章导读:
    ▪链接处置        链接处理 <anchor>元素,类似html中的锚该元素总是要规定一个任务(go,prev,refresh)。<?xml version="1.0" encoding="utf-8"?><!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN""http://www.wapforum.org/DTD/w.........
    ▪ 荧幕一张张翻        屏幕一张张翻 class PanelSwitcher extends FrameLayout {    private static final int MAJOR_MOVE = 60;    private static final int ANIM_DURATION = 400;     private GestureDetector mGestureDetector;    private int mCurrentView;    pri.........
    ▪ noop跟do元素       noop和do元素 noop是no operation的缩写,表示不做任何事。用于覆盖卡片组级别的元素。do用于在用户点击屏幕上的某个文字时,启动一个任务。<?xml version="1.0"?><!DOCTYPE wml PUBLIC "-//WAPFORUM.........

[1]链接处置
    来源: 互联网  发布时间: 2014-02-18
链接处理
<anchor>元素,类似html中的锚
该元素总是要规定一个任务(go,prev,refresh)。

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN"
"http://www.wapforum.org/DTD/wml_1.1.xml">

<wml>
<card id="first" title="my first wml_card">
<p>
<anchor>回去
<go href="/blog_article/wap_test.wml" />
</anchor>
</p>
</card>
</wml>
上面的例子中,点击回去后,会跳转到wap_test.wml

<a>标签会执行go任务。
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN"
"http://www.wapforum.org/DTD/wml_1.1.xml">

<wml>
<card id="first" title="my first wml_card">
<p>
<a href="/blog_article/2.wml">去2</a>
</p>
</card>
</wml>
上面的例子中可以看出和html中的a元素一样。


    
[2] 荧幕一张张翻
    来源: 互联网  发布时间: 2014-02-18
屏幕一张张翻

class PanelSwitcher extends FrameLayout {
    private static final int MAJOR_MOVE = 60;
    private static final int ANIM_DURATION = 400;

    private GestureDetector mGestureDetector;
    private int mCurrentView;
    private View mChild, mHistoryView;
    private View children[];

    private int mWidth;
    private TranslateAnimation inLeft;
    private TranslateAnimation outLeft;

    private TranslateAnimation inRight;
    private TranslateAnimation outRight;

    private static final int NONE  = 1;
    private static final int LEFT  = 2;
    private static final int RIGHT = 3;
    private int mPreviousMove;

    public PanelSwitcher(Context context, AttributeSet attrs) {
        super(context, attrs);
        mCurrentView = 0;
        mGestureDetector = new GestureDetector(context, new GestureDetector.SimpleOnGestureListener() {
                public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,
                                       float velocityY) {
                    int dx = (int) (e2.getX() - e1.getX());

                    // don't accept the fling if it's too short
                    // as it may conflict with a button push
                    if (Math.abs(dx) > MAJOR_MOVE && Math.abs(velocityX) > Math.abs(velocityY)) {
                        if (velocityX > 0) {
                            moveRight();
                        } else {
                            moveLeft();
                        }
                        return true;
                    } else {
                        return false;
                    }
                }
            });
    }

    @Override
    public void onSizeChanged(int w, int h, int oldW, int oldH) {
        mWidth = w;
        inLeft   = new TranslateAnimation(mWidth, 0, 0, 0);
        outLeft  = new TranslateAnimation(0, -mWidth, 0, 0);       
        inRight  = new TranslateAnimation(-mWidth, 0, 0, 0);
        outRight = new TranslateAnimation(0, mWidth, 0, 0);

        inLeft.setDuration(ANIM_DURATION);
        outLeft.setDuration(ANIM_DURATION);
        inRight.setDuration(ANIM_DURATION);
        outRight.setDuration(ANIM_DURATION);
    }

    protected void onFinishInflate() {
        int count = getChildCount();
        children = new View[count];
        for (int i = 0; i < count; ++i) {
            children[i] = getChildAt(i);
            if (i != mCurrentView) {
                children[i].setVisibility(View.GONE);
            }
        }
    }

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        mGestureDetector.onTouchEvent(event);
        return true;
    }

    @Override
    public boolean onInterceptTouchEvent(MotionEvent event) {
        return mGestureDetector.onTouchEvent(event);
    }

    void moveLeft() {
        //  <--
        if (mCurrentView < children.length - 1 && mPreviousMove != LEFT) {
            children[mCurrentView+1].setVisibility(View.VISIBLE);
            children[mCurrentView+1].startAnimation(inLeft);
            children[mCurrentView].startAnimation(outLeft);
            children[mCurrentView].setVisibility(View.GONE);

            mCurrentView++;
            mPreviousMove = LEFT;
        }
    }

    void moveRight() {
        //  -->
        if (mCurrentView > 0 && mPreviousMove != RIGHT) {
            children[mCurrentView-1].setVisibility(View.VISIBLE);
            children[mCurrentView-1].startAnimation(inRight);
            children[mCurrentView].startAnimation(outRight);
            children[mCurrentView].setVisibility(View.GONE);

            mCurrentView--;
            mPreviousMove = RIGHT;
        }
    }

    int getCurrentIndex() {
        return mCurrentView;
    }
}


    
[3] noop跟do元素
    来源: 互联网  发布时间: 2014-02-18
noop和do元素
noop
是no operation的缩写,表示不做任何事。用于覆盖卡片组级别的元素。

do
用于在用户点击屏幕上的某个文字时,启动一个任务。
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
"http://www.wapforum.org/DTD/wml_1.1.xml">

<wml>

<card id="card1" title="Tutorial">
<do type="accept" label="Answer">
  <go href="#card2"/>
</do>
<p>
<select name="name">
  <option value="HTML">HTML Tutorial</option>
  <option value="XML">XML Tutorial</option>
  <option value="WAP">WAP Tutorial</option>
</select>
</p>
</card>

<card id="card2" title="Answer">
<p>
You selected: $(name)
</p>
</card>

</wml>
在这个例子中,当点击do的文字Answer,会跳转到卡片card2
注意在card2中,会将变量为name的东西输出。变量name我们在card1中的select元素中的name属性设置。

<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
"http://www.wapforum.org/DTD/wml_1.1.xml">

<wml>

<card id="card1" title="Tutorial">
<do type="accept" label="Answer">

  <go href="#card2">
<setvar name="i" value="500"/>
  </go>
</do>
<p>
<select name="name">
  <option value="HTML">HTML Tutorial</option>
  <option value="XML">XML Tutorial</option>
  <option value="WAP">WAP Tutorial</option>
</select>
</p>
</card>

<card id="card2" title="Answer">
<p>
You selected: $(i)
</p>
</card>

</wml>
这个例子中输出的是变量i,变量i是我们在点击do,执行go指令的时候,设置的。

do-type属性:accept
prev
help
reset
options
delete
unknown
x-*
vnd.*

    
最新技术文章:
▪Android开发之登录验证实例教程
▪Android开发之注册登录方法示例
▪Android获取手机SIM卡运营商信息的方法
▪Android实现将已发送的短信写入短信数据库的...
▪Android发送短信功能代码
▪Android根据电话号码获得联系人头像实例代码
▪Android中GPS定位的用法实例
▪Android实现退出时关闭所有Activity的方法
▪Android实现文件的分割和组装
▪Android录音应用实例教程
▪Android双击返回键退出程序的实现方法
▪Android实现侦听电池状态显示、电量及充电动...
▪Android获取当前已连接的wifi信号强度的方法
▪Android实现动态显示或隐藏密码输入框的内容
▪根据USER-AGENT判断手机类型并跳转到相应的app...
▪Android Touch事件分发过程详解
▪Android中实现为TextView添加多个可点击的文本
▪Android程序设计之AIDL实例详解
▪Android显式启动与隐式启动Activity的区别介绍
▪Android按钮单击事件的四种常用写法总结
▪Android消息处理机制Looper和Handler详解
▪Android实现Back功能代码片段总结
▪Android实用的代码片段 常用代码总结
▪Android实现弹出键盘的方法
▪Android中通过view方式获取当前Activity的屏幕截...
▪Android提高之自定义Menu(TabMenu)实现方法
▪Android提高之多方向抽屉实现方法
▪Android提高之MediaPlayer播放网络音频的实现方法...
网站运营/SEO iis7站长之家
▪Android提高之手游转电视游戏的模拟操控
 


站内导航:


特别声明:169IT网站部分信息来自互联网,如果侵犯您的权利,请及时告知,本站将立即删除!

©2012-2021,,E-mail:www_#163.com(请将#改为@)

浙ICP备11055608号-3