# HarmonyOS应用开发基础——Slider案例详解

HarmonyOS应用开发基础——Slider组件案例详解

HarmonyOS应用开发基础

  • HarmonyOS应用开发基础——Slider组件案例详解
    • 案例详解
      • 基础代码使用
        • xml文件
        • java文件
      • 代码进阶(图片放大器)
        • xml文件
        • java文件

案例详解

基础代码使用

xml文件
 
<DirectionalLayout xmlns:ohos="http://schemas.huawei.com/res/ohos" ohos:height="match_parent"
 ohos:width="match_parent" 
 ohos:alignment="center" 
 ohos:orientation="vertical"> 
<Slider 
ohos:id="$+id:slider" 
ohos:height="50vp" 
ohos:width="300vp" ohos:background_instruct_element="#0000FF" ohos:enabled="true" 
ohos:progress_color="#FF0000" 
ohos:thumb_element="#00FF00" 
ohos:vice_progress="80" 
ohos:vice_progress_element="#923456" 
ohos:max="100" 
ohos:min="0" /> 
DirectionalLayout>
java文件
public class MainAbilitySlice extends AbilitySlice implements Slider.ValueChangedListener {
    
	@Override
	public void onStart(

你可能感兴趣的:(HarmonyOS应用开发,harmonyos)