画骨成沙

文章 评论 浏览 803

画骨成沙 2025-02-19 17:52:41

错误的原因

SimpleStorageArray.push[simpleStoarge]; 

看起来您有一个错字,这可能是

SimpleStorageArray.push[simpleStorage]; 

Looks like you have a typo which might be the cause of the error

SimpleStorageArray.push[simpleStoarge]; 

should be

SimpleStorageArray.push[simpleStorage]; 

声明:未找到或未唯一的标识符。 line5这是我尝试多次编写代码但未解决我的错误的错误

画骨成沙 2025-02-19 11:28:22

代码中没有错误,但是在对话框元素中,您需要收听oncancel事件,而不是onclose事件。

ReactDOM.render(
      <App />,
      document.getElementById("root")
 );

function App() {
  const modalRef = React.createRef()
  
  function handleClose(e) { // press escape button to trigger this
    e.preventDefault()
    console.log('closing')
  }
  
  return(
    <React.Fragment>
      <button 
        onClick={() => modalRef.current.showModal()}>
        Open modal
      </button>
      
      
      <dialog
        ref={modalRef}
        onCancel={handleClose}>
        Hello world
      </dialog>
    </React.Fragment>
  )
}

There is no error in your code but in the dialog element you need to listen to onCancel event instead of onClose event.

ReactDOM.render(
      <App />,
      document.getElementById("root")
 );

function App() {
  const modalRef = React.createRef()
  
  function handleClose(e) { // press escape button to trigger this
    e.preventDefault()
    console.log('closing')
  }
  
  return(
    <React.Fragment>
      <button 
        onClick={() => modalRef.current.showModal()}>
        Open modal
      </button>
      
      
      <dialog
        ref={modalRef}
        onCancel={handleClose}>
        Hello world
      </dialog>
    </React.Fragment>
  )
}

防止HTML模态对话框关闭

画骨成沙 2025-02-19 08:11:58

您可以做这样的事情:

  1. 删除最小值并添加max-height:100VH; on .modal
  2. 添加最大高调:calc(100VH -80px)(80px是按钮 +桨板 +呼吸模态的更多空间)和溢出:auto在模态上身体(我假设的第一个Div)。
<div id="modal">
  <div class="modal">
    <div class="modal-body">
      body<br>body<br>body<br>body<br>body<br>body<br>body<br>body<br>body<br>body
    </div>
    <div class="modal-actions">
      actions
    </div>
  </div>
</div>

#modal{
    position:absolute;
    z-index:1;
    top:0;
    left:0;
    bottom:0;
    right:0;
    display:flex;
    background:red;
}

.modal{
    margin:auto;
    padding:20px;
    width:200px;
    display:flex;
    flex-flow:column wrap;
    justify-content:space-between;
    align-items:stretch;
    background:#fff;
    max-height: 100vh;
}

.modal-body {
    max-height: calc(100vh - 80px);
    overflow: auto;
}

.modal-actions{
    padding-top:10px;
    text-align:right;
  background:yellow;
}

You can do something like that:

  1. Remove min-height and add max-height: 100vh; on .modal.
  2. Add max-height: calc(100vh - 80px) (80px is the button + paddings + a little more space for the modal to breathe) and overflow: auto on the modal body (the first div I assume).
<div id="modal">
  <div class="modal">
    <div class="modal-body">
      body<br>body<br>body<br>body<br>body<br>body<br>body<br>body<br>body<br>body
    </div>
    <div class="modal-actions">
      actions
    </div>
  </div>
</div>

#modal{
    position:absolute;
    z-index:1;
    top:0;
    left:0;
    bottom:0;
    right:0;
    display:flex;
    background:red;
}

.modal{
    margin:auto;
    padding:20px;
    width:200px;
    display:flex;
    flex-flow:column wrap;
    justify-content:space-between;
    align-items:stretch;
    background:#fff;
    max-height: 100vh;
}

.modal-body {
    max-height: calc(100vh - 80px);
    overflow: auto;
}

.modal-actions{
    padding-top:10px;
    text-align:right;
  background:yellow;
}

flexbox不夸大父位置:绝对

画骨成沙 2025-02-18 23:16:35

您可以使用 flex

实时代码: codepen html

html:

   <div class='alert'>
      <span class='alert-icon'>icon</span>
      <div class='alert-content'>
        <div>text</div>
        <div>text</div>
        <div>text</div>
      </div>
      <span class='alert-close-icon'> close icon </span>
   </div>

css:

.alert {
  background-color: red;
  color:#fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 250px;
  border-radius: 6px;
  padding: 10px 10px
}

只需添加图像,然后将图像替换为<代码> .Alert-icon .Alert-close-icon

You can use Flex.

Live code: Codepen

HTML:

   <div class='alert'>
      <span class='alert-icon'>icon</span>
      <div class='alert-content'>
        <div>text</div>
        <div>text</div>
        <div>text</div>
      </div>
      <span class='alert-close-icon'> close icon </span>
   </div>

CSS:

.alert {
  background-color: red;
  color:#fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 250px;
  border-radius: 6px;
  padding: 10px 10px
}

Just add the images and replace them with the text inside .alert-icon .alert-close-icon

在文本中间位置图标

画骨成沙 2025-02-18 11:51:03

您对 bcustomer 表的最后一个插入件是

insert into bcustomer (item_id, customer_id, quan, price) values (4, 12, 19, 13);

customer中没有任何匹配的 last_order_id

如果您将运行

insert into bcustomer (item_id, customer_id, quan, price) values (4, 1, 19, 13);

customer_id = 1 ,它将更新您的 customer 表,因为它具有匹配的ID,即 1

尝试此

Your last insert for bcustomer table is

insert into bcustomer (item_id, customer_id, quan, price) values (4, 12, 19, 13);

which doesn't have any matching last_order_id in acustomer.

If you will run

insert into bcustomer (item_id, customer_id, quan, price) values (4, 1, 19, 13);

customer_id = 1, it will update your acustomer table since it has a matching id, which is 1.

try this dbfiddle.

为什么它没有显示这样的专栏

画骨成沙 2025-02-17 18:48:48

var testarray = newbody.split('&gt;');
// TypeError:无法读取未定义

的属性“拆分”

newbody的属性'split'的属性 undefined。因此,引擎无法读取未定义的属性“拆分”。仅字符串 S具有split属性。

为什么未定义

var newbody = partsarray [1];

因为partsarray没有两个元素。如果partsarray[0]而不是[0,1],那么它没有第二个元素[1]访问。

为什么partarray有两个元素?

var partsarray = thebody.split('&lt;');

可能是因为中没有&lt;

var testArray = newBody.split('>');
//TypeError: Cannot read property 'split' of undefined

newBody is undefined. So, the engine cannot read property 'split' of undefined. Only strings have a split property.

Why is it undefined?

var newBody = partsArray[1];

Because partsArray doesn't have two elements. If partsArray is [0] instead of [0,1], then it doesn't have a second element [1] to access.

Why doesn't partsArray have two elements?

var partsArray = theBody.split('<');

Probably because there's no < in theBody.

在应用程序脚本类型中解析文本:无法读取属性&#x27; split&#x27;不确定的

画骨成沙 2025-02-17 18:11:59

请查看您使用的代码顺序

_product.push_back(new Wet(Pquantity, Pprice ,Pcode, Pname, Mname, Madd, Mcont));

...

class Wet : public Product
{
    public:
        Wet(int pQuan, double pPrice, int pCode, string pName, string mName, string mAdd, string mCon) : Product(pQuan, pPrice, pCode, pName, mName, mAdd, mCon){}
};

在定义它们之前, 。这就是为什么编译器不认识它们的原因。

要解决,您将必须将product的定义:: editproduct类中移出,然后将其放在代码中的某个地方,以便在声明编译器已经看到了湿和干燥

Look at the order of your code

_product.push_back(new Wet(Pquantity, Pprice ,Pcode, Pname, Mname, Madd, Mcont));

...

class Wet : public Product
{
    public:
        Wet(int pQuan, double pPrice, int pCode, string pName, string mName, string mAdd, string mCon) : Product(pQuan, pPrice, pCode, pName, mName, mAdd, mCon){}
};

You are using Wet (and Dry) before you have defined them. That's why the compiler doesn't recognise them.

To fix you will have to move the definition of Product::edit out of the Product class and place in somewhere in your code so that it occurs after the declarations of Wet and Dry have been seen by the compiler.

如何使用vector类对象指针从父类创建新的子实例?

画骨成沙 2025-02-17 17:17:38

您的Response Body变量中有一个错字,尝试:json.parse(wendespbody)

There's a typo in your responseBody variable, try: JSON.parse(responseBody)

我获得此错误“参考:未定义”

画骨成沙 2025-02-17 15:42:49

导入存储为命名导入(您将其导出为命名导出)

import { Store } from "../src/components/context/Points";

Import Store as named import (you exported it as named export)

import { Store } from "../src/components/context/Points";

使用具有上下文的全球状态

画骨成沙 2025-02-17 13:49:45

我在listView.builder作为自动完成小部件的一部分中遇到了同样的滚动问题。我发现确保通话以某种方式与滚动相冲突,因此我评论了。因为当您要使用键盘的向上和下键时,需要它,而我在应用中不需要它。希望这可以帮助您缩小错误。

if (highlight) {
  SchedulerBinding.instance
      .addPostFrameCallback((Duration timeStamp) {
    Scrollable.ensureVisible(context, alignment: 0.5);
  });
}

I had the same scrolling up problem with a ListView.Builder as part of an Autocomplete Widget. I found that the ensureVisible call somehow conflicted with scrolling up, so I commented it out. Because it is needed when you want to use the up and down keys of a keyboard and I don't need that in my app. Hope this helps you narrow down your bug.

if (highlight) {
  SchedulerBinding.instance
      .addPostFrameCallback((Duration timeStamp) {
    Scrollable.ensureVisible(context, alignment: 0.5);
  });
}

Flutter:带有StreamBuilder Janky的ListView滚动

画骨成沙 2025-02-17 11:09:59

看来您正在尝试访问数据库类上不存在的属性itemclass。您确实在中访问itemclass属性语句。

也许取代

Database.itemClass += 1;

会有所

instance.items.allItems[i].itemClass += 1;

帮助?

然后,您实际上是在使用数据库类的当前实例,并且能够从中访问item itemdatabase 。

您尝试使用database.itemclass进行操作的方式只有在您具有itemClass database类中静态定义的情况下才能使用。您需要数据库类的实际实例才能访问您的itemDatabase。 (请参阅静态类上的Microsoft的文档在这里

It seems you are trying to access a property itemClass that doesn't exist on your Database class. You do access an itemClass property in your if statement though.

Perhaps replacing

Database.itemClass += 1;

with

instance.items.allItems[i].itemClass += 1;

would help?

Then you are actually using your current instance of the Database class, and able to access the items ItemDatabase from it.

The way you tried to do it using Database.itemClass would only work if you had itemClass statically defined in the Database class. You need an actual instance of the Database class to access your ItemDatabase. (See Microsoft's documentation on static classes here)

在C#中,我可以将列表密钥用作方法中的参数吗?

画骨成沙 2025-02-17 02:05:43

我们可以使用tidyr :: axtim_rows的默认值将单位序列拆分为每个单独的行,然后加入两个表。由于公寓该变量的版本是整数,因此我使用convert = true来让tidyr猜测预期的输出格式,它确实正确在这种情况下。如果没有,我们可以添加一个突变(单位= as.integer(umit))%&gt;%行。

library(dplyr)
apartment_long <- apartment %>% tidyr::separate_rows(units, convert = TRUE)
participant %>% left_join(apartment_long, by = c("Apartmentvisits" = "units"))

结果

 A tibble: 1,011 × 3
   participantId Apartmentvisits region    
           <dbl>           <int> <chr>     
 1             0             786 NA        
 2             1            1093 North-west
 3             2             949 NA        
 4             3             827 NA        
 5             4             963 NA        
 6             5             997 NA        
 7             6            1220 NA        
 8             7            1118 NA        
 9             8            1174 NA        
10             9             860 NA        
# … with 1,001 more rows

We could use tidyr::separate_rows's defaults to split the units sequences into separate lines for each, and then join the two tables. Since the apartment version of the variable is an integer, I use convert = TRUE to let tidyr guess the intended output format, which it does correctly in this case. If it hadn't, we could add a mutate(units = as.integer(units)) %>% line to do so.

library(dplyr)
apartment_long <- apartment %>% tidyr::separate_rows(units, convert = TRUE)
participant %>% left_join(apartment_long, by = c("Apartmentvisits" = "units"))

Result

 A tibble: 1,011 × 3
   participantId Apartmentvisits region    
           <dbl>           <int> <chr>     
 1             0             786 NA        
 2             1            1093 North-west
 3             2             949 NA        
 4             3             827 NA        
 5             4             963 NA        
 6             5             997 NA        
 7             6            1220 NA        
 8             7            1118 NA        
 9             8            1174 NA        
10             9             860 NA        
# … with 1,001 more rows

根据从R中的另一个数据表提取列值

画骨成沙 2025-02-17 01:14:28

请检查下面的代码,

public class RippleBackground extends RelativeLayout{

    private static final int DEFAULT_RIPPLE_COUNT=6;
    private static final int DEFAULT_DURATION_TIME=3000;
    private static final float DEFAULT_SCALE=6.0f;
    private static final int DEFAULT_FILL_TYPE=0;

    private int rippleColor;
    private float rippleStrokeWidth;
    private float rippleRadius;
    private int rippleDurationTime;
    private int rippleAmount;
    private int rippleDelay;
    private float rippleScale;
    private int rippleType;
    private Paint paint;
    private boolean animationRunning=false;
    private AnimatorSet animatorSet;
    private ArrayList<Animator> animatorList;
    private LayoutParams rippleParams;
    private ArrayList<RippleView> rippleViewList=new ArrayList<RippleView>();

    public RippleBackground(Context context) {
        super(context);
    }

    public RippleBackground(Context context, AttributeSet attrs) {
        super(context, attrs);
        init(context, attrs);
    }

    public RippleBackground(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        init(context, attrs);
    }

    private void init(final Context context, final AttributeSet attrs) {
        if (isInEditMode())
            return;

        if (null == attrs) {
            throw new IllegalArgumentException("Attributes should be provided to this view,");
        }

        final TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.RippleBackground);
        rippleColor=typedArray.getColor(R.styleable.RippleBackground_rb_color, getResources().getColor(R.color.rippelColor));
        rippleStrokeWidth=typedArray.getDimension(R.styleable.RippleBackground_rb_strokeWidth, getResources().getDimension(R.dimen.rippleStrokeWidth));
        rippleRadius=typedArray.getDimension(R.styleable.RippleBackground_rb_radius,getResources().getDimension(R.dimen.rippleRadius));
        rippleDurationTime=typedArray.getInt(R.styleable.RippleBackground_rb_duration,DEFAULT_DURATION_TIME);
        rippleAmount=typedArray.getInt(R.styleable.RippleBackground_rb_rippleAmount,DEFAULT_RIPPLE_COUNT);
        rippleScale=typedArray.getFloat(R.styleable.RippleBackground_rb_scale,DEFAULT_SCALE);
        rippleType=typedArray.getInt(R.styleable.RippleBackground_rb_type,DEFAULT_FILL_TYPE);
        typedArray.recycle();

        rippleDelay=rippleDurationTime/rippleAmount;

        paint = new Paint();
        paint.setAntiAlias(true);
        if(rippleType==DEFAULT_FILL_TYPE){
            rippleStrokeWidth=0;
            paint.setStyle(Paint.Style.FILL);
        }else
            paint.setStyle(Paint.Style.STROKE);
        paint.setColor(rippleColor);

        rippleParams=new LayoutParams((int)(2*(rippleRadius+rippleStrokeWidth)),(int)(2*(rippleRadius+rippleStrokeWidth)));
        rippleParams.addRule(CENTER_IN_PARENT, TRUE);

        animatorSet = new AnimatorSet();
        animatorSet.setInterpolator(new AccelerateDecelerateInterpolator());
        animatorList=new ArrayList<Animator>();

        for(int i=0;i<rippleAmount;i++){
            RippleView rippleView=new RippleView(getContext());
            addView(rippleView,rippleParams);
            rippleViewList.add(rippleView);
             final ObjectAnimator scaleXAnimator = ObjectAnimator.ofFloat(rippleView, "ScaleX", 1.0f, rippleScale);
            scaleXAnimator.setRepeatCount(ObjectAnimator.INFINITE);
            scaleXAnimator.setRepeatMode(ObjectAnimator.RESTART);
            scaleXAnimator.setStartDelay(i * rippleDelay);
            scaleXAnimator.setDuration(rippleDurationTime);
            animatorList.add(scaleXAnimator);
            final ObjectAnimator scaleYAnimator = ObjectAnimator.ofFloat(rippleView, "ScaleY", 1.0f, rippleScale);
            scaleYAnimator.setRepeatCount(ObjectAnimator.INFINITE);
            scaleYAnimator.setRepeatMode(ObjectAnimator.RESTART);
            scaleYAnimator.setStartDelay(i * rippleDelay);
            scaleYAnimator.setDuration(rippleDurationTime);
            animatorList.add(scaleYAnimator);
            final ObjectAnimator alphaAnimator = ObjectAnimator.ofFloat(rippleView, "Alpha", 1.0f, 0f);
            alphaAnimator.setRepeatCount(ObjectAnimator.INFINITE);
            alphaAnimator.setRepeatMode(ObjectAnimator.RESTART);
            alphaAnimator.setStartDelay(i * rippleDelay);
            alphaAnimator.setDuration(rippleDurationTime);
            animatorList.add(alphaAnimator);
        }

        animatorSet.playTogether(animatorList);
    }

    private class RippleView extends View{

        public RippleView(Context context) {
            super(context);
            this.setVisibility(View.INVISIBLE);
        }

        @Override
        protected void onDraw(Canvas canvas) {
            int radius=(Math.min(getWidth(),getHeight()))/2;
            canvas.drawCircle(radius,radius,radius-rippleStrokeWidth,paint);
        }
    }

    public void startRippleAnimation(){
        if(!isRippleAnimationRunning()){
            for(RippleView rippleView:rippleViewList){
                rippleView.setVisibility(VISIBLE);
            }
            animatorSet.start();
            animationRunning=true;
        }
    }

    public void stopRippleAnimation(){
        if(isRippleAnimationRunning()){
            animatorSet.end();
            animationRunning=false;
        }
    }

    public boolean isRippleAnimationRunning(){
        return animationRunning;
    }
}

在attr.xml文件中添加此添加,

<declare-styleable name="RippleBackground">
        <attr name="rb_color" format="color" />
        <attr name="rb_strokeWidth" format="dimension"/>
        <attr name="rb_radius" format="dimension"/>
        <attr name="rb_duration" format="integer"/>
        <attr name="rb_rippleAmount" format="integer"/>
        <attr name="rb_scale" format="float"/>
        <attr name="rb_type" format="enum">
            <enum name="fillRipple" value="0"/>
            <enum name="strokeRipple" value="1"/>
        </attr>
    </declare-styleable>

在color.xml文件中添加color.xml文件

<color name="rippelColor">#0099CC</color>

添加dimen.xml文件

<dimen name="rippleStrokeWidth">2dp</dimen>
    <dimen name="rippleRadius">64dp</dimen>

之后,添加上述代码后,只需在您的活动中启动动画

rippleBackground.startRippleAnimation();

Please check below code,

public class RippleBackground extends RelativeLayout{

    private static final int DEFAULT_RIPPLE_COUNT=6;
    private static final int DEFAULT_DURATION_TIME=3000;
    private static final float DEFAULT_SCALE=6.0f;
    private static final int DEFAULT_FILL_TYPE=0;

    private int rippleColor;
    private float rippleStrokeWidth;
    private float rippleRadius;
    private int rippleDurationTime;
    private int rippleAmount;
    private int rippleDelay;
    private float rippleScale;
    private int rippleType;
    private Paint paint;
    private boolean animationRunning=false;
    private AnimatorSet animatorSet;
    private ArrayList<Animator> animatorList;
    private LayoutParams rippleParams;
    private ArrayList<RippleView> rippleViewList=new ArrayList<RippleView>();

    public RippleBackground(Context context) {
        super(context);
    }

    public RippleBackground(Context context, AttributeSet attrs) {
        super(context, attrs);
        init(context, attrs);
    }

    public RippleBackground(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        init(context, attrs);
    }

    private void init(final Context context, final AttributeSet attrs) {
        if (isInEditMode())
            return;

        if (null == attrs) {
            throw new IllegalArgumentException("Attributes should be provided to this view,");
        }

        final TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.RippleBackground);
        rippleColor=typedArray.getColor(R.styleable.RippleBackground_rb_color, getResources().getColor(R.color.rippelColor));
        rippleStrokeWidth=typedArray.getDimension(R.styleable.RippleBackground_rb_strokeWidth, getResources().getDimension(R.dimen.rippleStrokeWidth));
        rippleRadius=typedArray.getDimension(R.styleable.RippleBackground_rb_radius,getResources().getDimension(R.dimen.rippleRadius));
        rippleDurationTime=typedArray.getInt(R.styleable.RippleBackground_rb_duration,DEFAULT_DURATION_TIME);
        rippleAmount=typedArray.getInt(R.styleable.RippleBackground_rb_rippleAmount,DEFAULT_RIPPLE_COUNT);
        rippleScale=typedArray.getFloat(R.styleable.RippleBackground_rb_scale,DEFAULT_SCALE);
        rippleType=typedArray.getInt(R.styleable.RippleBackground_rb_type,DEFAULT_FILL_TYPE);
        typedArray.recycle();

        rippleDelay=rippleDurationTime/rippleAmount;

        paint = new Paint();
        paint.setAntiAlias(true);
        if(rippleType==DEFAULT_FILL_TYPE){
            rippleStrokeWidth=0;
            paint.setStyle(Paint.Style.FILL);
        }else
            paint.setStyle(Paint.Style.STROKE);
        paint.setColor(rippleColor);

        rippleParams=new LayoutParams((int)(2*(rippleRadius+rippleStrokeWidth)),(int)(2*(rippleRadius+rippleStrokeWidth)));
        rippleParams.addRule(CENTER_IN_PARENT, TRUE);

        animatorSet = new AnimatorSet();
        animatorSet.setInterpolator(new AccelerateDecelerateInterpolator());
        animatorList=new ArrayList<Animator>();

        for(int i=0;i<rippleAmount;i++){
            RippleView rippleView=new RippleView(getContext());
            addView(rippleView,rippleParams);
            rippleViewList.add(rippleView);
             final ObjectAnimator scaleXAnimator = ObjectAnimator.ofFloat(rippleView, "ScaleX", 1.0f, rippleScale);
            scaleXAnimator.setRepeatCount(ObjectAnimator.INFINITE);
            scaleXAnimator.setRepeatMode(ObjectAnimator.RESTART);
            scaleXAnimator.setStartDelay(i * rippleDelay);
            scaleXAnimator.setDuration(rippleDurationTime);
            animatorList.add(scaleXAnimator);
            final ObjectAnimator scaleYAnimator = ObjectAnimator.ofFloat(rippleView, "ScaleY", 1.0f, rippleScale);
            scaleYAnimator.setRepeatCount(ObjectAnimator.INFINITE);
            scaleYAnimator.setRepeatMode(ObjectAnimator.RESTART);
            scaleYAnimator.setStartDelay(i * rippleDelay);
            scaleYAnimator.setDuration(rippleDurationTime);
            animatorList.add(scaleYAnimator);
            final ObjectAnimator alphaAnimator = ObjectAnimator.ofFloat(rippleView, "Alpha", 1.0f, 0f);
            alphaAnimator.setRepeatCount(ObjectAnimator.INFINITE);
            alphaAnimator.setRepeatMode(ObjectAnimator.RESTART);
            alphaAnimator.setStartDelay(i * rippleDelay);
            alphaAnimator.setDuration(rippleDurationTime);
            animatorList.add(alphaAnimator);
        }

        animatorSet.playTogether(animatorList);
    }

    private class RippleView extends View{

        public RippleView(Context context) {
            super(context);
            this.setVisibility(View.INVISIBLE);
        }

        @Override
        protected void onDraw(Canvas canvas) {
            int radius=(Math.min(getWidth(),getHeight()))/2;
            canvas.drawCircle(radius,radius,radius-rippleStrokeWidth,paint);
        }
    }

    public void startRippleAnimation(){
        if(!isRippleAnimationRunning()){
            for(RippleView rippleView:rippleViewList){
                rippleView.setVisibility(VISIBLE);
            }
            animatorSet.start();
            animationRunning=true;
        }
    }

    public void stopRippleAnimation(){
        if(isRippleAnimationRunning()){
            animatorSet.end();
            animationRunning=false;
        }
    }

    public boolean isRippleAnimationRunning(){
        return animationRunning;
    }
}

in attrs.xml file add this ,

<declare-styleable name="RippleBackground">
        <attr name="rb_color" format="color" />
        <attr name="rb_strokeWidth" format="dimension"/>
        <attr name="rb_radius" format="dimension"/>
        <attr name="rb_duration" format="integer"/>
        <attr name="rb_rippleAmount" format="integer"/>
        <attr name="rb_scale" format="float"/>
        <attr name="rb_type" format="enum">
            <enum name="fillRipple" value="0"/>
            <enum name="strokeRipple" value="1"/>
        </attr>
    </declare-styleable>

add color in color.xml file

<color name="rippelColor">#0099CC</color>

add dimension in dimen.xml file

<dimen name="rippleStrokeWidth">2dp</dimen>
    <dimen name="rippleRadius">64dp</dimen>

After adding above code just start animation like this in your activity

rippleBackground.startRippleAnimation();

连续的连锁动画 - Android

画骨成沙 2025-02-16 00:27:27

这是Tomcat 10上的一个常见问题,因为从Java EE到Jakarta EE的更改,因此您可以使用Jakarta EE 9更改项目

    <dependency>
        <groupId>jakarta.platform</groupId>
        <artifactId>jakarta.jakartaee-api</artifactId>
        <version>9.0.0</version>
        <scope>provided</scope>
    </dependency>

并导入此软件包

import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

,如果您不想这样做,则可以降级到Tomcat 9。

有关相关文档,请参见以下链接

tomcat 10.0.4不加载servlet(@webservlet类)404错误

This is a common issue on Tomcat 10 because the change from Java EE to Jakarta EE, so you can change your project, using Jakarta EE 9

    <dependency>
        <groupId>jakarta.platform</groupId>
        <artifactId>jakarta.jakartaee-api</artifactId>
        <version>9.0.0</version>
        <scope>provided</scope>
    </dependency>

and importing this packages

import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

If you don´t want to do that, you can downgrade to Tomcat 9.

For related documentation follow this link

Tomcat 10.0.4 doesn't load servlets (@WebServlet classes) with 404 error

servlet给出了服务器找不到目标资源的当前表示形式的错误

画骨成沙 2025-02-15 22:43:30

流中发生了许多转换:

Project -> ProjectRelease -> Release -> Track -> Resource -> Track -> Release

它们正在沿不同的“方向”进行,这不是很直观。

您可以引入一种负责检查特定版本的任何资源 resource 属于给定的 country

如果我正确理解您的逻辑,可以像这样写:

public static List<Release> getReleasesByCountry(Project project,
                                                 String countryName) {
    return project.getProjectReleases().stream()
        .map(ProjectRelease::getRelease)
        .filter(resource -> hasResourceByCountry(resource, countryName))
        .collect(Collectors.toList());
}

public static boolean hasResourceByCountry(Release release,
                                           String countryName) {
    
    return release.getTracks().stream()
        .map(Track::getResource)
        .anyMapth(resource -> countryName.equals(resource.getCountry()));
}

There are many transformations happening in the stream:

Project -> ProjectRelease -> Release -> Track -> Resource -> Track -> Release

And they are going in different "directions" which is not very intuitive.

You can introduce a separate method responsible for checking if any of the resources of a particular release belongs to a given country.

If I understood your logic correctly it can be written like that:

public static List<Release> getReleasesByCountry(Project project,
                                                 String countryName) {
    return project.getProjectReleases().stream()
        .map(ProjectRelease::getRelease)
        .filter(resource -> hasResourceByCountry(resource, countryName))
        .collect(Collectors.toList());
}

public static boolean hasResourceByCountry(Release release,
                                           String countryName) {
    
    return release.getTracks().stream()
        .map(Track::getResource)
        .anyMapth(resource -> countryName.equals(resource.getCountry()));
}

用Java -streams过滤 - 找到对象的出现,匹配属性嵌套在另一个对象中

更多

推荐作者

櫻之舞

文章 0 评论 0

弥枳

文章 0 评论 0

m2429

文章 0 评论 0

野却迷人

文章 0 评论 0

我怀念的。

文章 0 评论 0

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文