英文track是啥意思,track翻译解释,track中文意思,track用法及读音

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了英文track是啥意思,track翻译解释,track中文意思,track用法及读音相关的知识,希望对你有一定的参考价值。

track
[英][træk][美][træk]
n.小路,小道; 痕迹,踪迹; 轨道,音轨; 方针,路线;
vt.跟踪; 监看,监测; 追踪;
vi.沿着轨道前进; 沿着一条路走,旅行; 位于一队列中

1.N-COUNT小道;小径A track is a narrow road or path.

We set off once more, over a rough mountain track.

我们沿着一条崎岖的山间小路再度出发。

2.N-COUNT跑道;赛道A track is a piece of ground, often oval-shaped, that is used for races involving athletes, cars, bicycles, horses, or dogs called greyhounds.

The two men turned to watch the horses going round the track.

那两个男人转身观看赛马沿赛道而行。

3.N-COUNT铁轨;轨道Railway tracks are the rails that a train travels along.语法信息

A woman fell on to the tracks.

一名女子摔倒在铁轨上。
参考技术A track 英[træk] 美[træk]
n. 小路,小道;痕迹,踪迹;轨道,音轨;方针,路线
vt. 跟踪;监看,监测;追踪
vi. 沿着轨道前进;沿着一条路走,旅行;位于一队列中
[例句]Figuring out how to track the impact mobile advertising has on consumers.
首先它要解决的是如何追踪移动广告对消费者的影响。

[SwitchPreference]代码中动态修改SwitchPreference的Thumb或Track颜色

所有自定义代码在下面▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼

     

逻辑就是自定义个class继承SwitchPreference,拿到switch,给switch设置checkChange监听就可以了;

      解释下为何holder.findViewById(16908352)中id是16908352呢?因为我们是继承自support-v14中的SwitchPreference,(注意:不是android.preference.SwitchPreference,这个已经被弃用了),查看SwitchPreference中onBindViewHoldr的代码,它的Switch是局部变量,所以我们是无法继承的,但已知switch的id是16908352,所以我们直接拿过来用就可以了,不用纠结它的id常量名是什么.

 

package com.android.MySettings.widget;

import android.annotation.SuppressLint;
import android.content.Context;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.support.v14.preference.SwitchPreference;
import android.support.v7.preference.PreferenceViewHolder;
import android.util.AttributeSet;
import android.widget.CompoundButton;
import android.widget.Switch;

/**
 * When I wrote this,only God and I understood what I was doing.
 * Now, God only knows.
 *
 * @fileName:MySwitchPreference
 * @author:86132
 * @date:2022/12/15 17:56
 */
public class MySwitchPreference extends SwitchPreference 

    private Switch mSwitch;
    private SharedPreferences mSharedPreferences;

    public MySwitchPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) 
        super(context, attrs, defStyleAttr, defStyleRes);
    

    public MySwitchPreference(Context context, AttributeSet attrs, int defStyleAttr) 
        super(context, attrs, defStyleAttr);
    

    public MySwitchPreference(Context context, AttributeSet attrs) 
        super(context, attrs);
    

    public MySwitchPreference(Context context) 
        super(context);
    


    @SuppressLint("ResourceType")
    @Override
    public void onBindViewHolder(PreferenceViewHolder holder) 
        super.onBindViewHolder(holder);
        mSwitch = (Switch) holder.findViewById(16908352);
        if(null != mSwitch)
        
            changeColor(mSwitch.isChecked(),mSwitch.isEnabled());
            mSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() 
                @Override
                public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) 
                    changeColor(isChecked,mSwitch.isEnabled());
                
            );
        
    

    private void changeColor(boolean checked, boolean enabled)
        try 
            mSharedPreferences = getContext().getSharedPreferences("settings_data",Context.MODE_PRIVATE);
            int thumbCheckedColor = Color.parseColor("#33ff99");
            int thumbUncheckedColor = Color.parseColor("#ECECEC");
/*            int trackCheckedColor = mSharedPreferences.getInt("theme_color_key",Color.parseColor("#3F51B5"));
            int trackUncheckedColor = Color.parseColor("#B9B9B9");*/
            if(enabled)
                mSwitch.getThumbDrawable().setColorFilter(checked ? thumbCheckedColor : thumbUncheckedColor, PorterDuff.Mode.MULTIPLY);
//                mSwitch.getTrackDrawable().setColorFilter(checked ? trackCheckedColor : trackUncheckedColor, PorterDuff.Mode.MULTIPLY);
            else 
                mSwitch.getThumbDrawable().setColorFilter(Color.parseColor("#B9B9B9"), PorterDuff.Mode.MULTIPLY);
//                mSwitch.getTrackDrawable().setColorFilter(Color.parseColor("#E9E9E9"), PorterDuff.Mode.MULTIPLY);
            
        catch (NullPointerException e)
            e.printStackTrace();
        
    
    

以上是关于英文track是啥意思,track翻译解释,track中文意思,track用法及读音的主要内容,如果未能解决你的问题,请参考以下文章

tracks是啥意思啊

track的短语搭配

a11y:视频聊天的正确 `<track>` 元素是啥?

Online Object Tracking: A Benchmark 翻译

adaptive color attributes for tracking翻译

ReactJS:如何将子组件传递给它的祖先?