zoukankan      html  css  js  c++  java
  • 高级控件上(二)

    3.拖动条(SeekBar)
    sb1.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {

    @Override
    public void onStopTrackingTouch(SeekBar seekBar) {
    tv1.setText("---结束拖动---");
    }

    @Override
    public void onStartTrackingTouch(SeekBar seekBar) {
    tv1.setText("---开始拖动---");
    }

    @Override
    public void onProgressChanged(SeekBar seekBar, int progress,
    boolean fromUser) {
    tv1.setText("---拖动进度---"+progress);
    }
    });

    4.滚动视图(ScrollView)
    <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="100dp"
    >

    <LinearLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    >

    <TextView
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="@string/hello"
    android:layout_marginTop="50dp"
    />

    <TextView
    android:layout_marginTop="50dp"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="aaaa"
    />

    </LinearLayout>

    </ScrollView>

    5.列表视图(ListView)
    <ListView
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:background="#CD950C"
    android:entries="@array/citys"
    ></ListView>

    6.SimpleAdapter类设置列表视图
    lv1=(ListView) findViewById(R.id.lv101);
    List<Map<String, Object>> list=new ArrayList<Map<String,Object>>();

    Map<String, Object> map=new HashMap<String, Object>();
    map.put("img", R.drawable.icon);
    map.put("txt", "bbbb");
    list.add(map);

    Map<String, Object> map1=new HashMap<String, Object>();
    map1.put("img", R.drawable.icon);
    map1.put("txt", "aaaa");
    list.add(map1);

    SimpleAdapter adapter=new SimpleAdapter(this, list,
    R.layout.list_item,
    new String []{"img","txt"},
    new int [] {R.id.iv99,R.id.tv022});
    lv1.setAdapter(adapter);

  • 相关阅读:
    iOS 基础复习
    iOS项目立项
    Cocos2d-JS项目之四:UI界面的优化
    Cocos2d-JS项目之三:使用合图
    Cocos2d-JS项目之二:studio基础控件的使用
    Cocos2d-JS项目之一:环境(IDE 运行js-tests、IDE 和 studio 统一工程)
    字节对齐导致的iOS EXC_ARM_DA_ALIGN崩溃
    cocos2dx 2.x 骨骼动画优化
    Cocos2dx 把 glview 渲染到 Qt 控件上(Mac 环境)
    [leetcode 周赛 160] 1240 铺瓷砖
  • 原文地址:https://www.cnblogs.com/ch123456/p/6895855.html
Copyright © 2011-2022 走看看