2016-12-23 4 views
0

У меня возникла проблема с витриной View, которая отображается под программной клавишей в android marshmallow, но она отлично отображается в версии kitkat.Как исправить эту кнопку витрины

здесь вид, как она выглядит в зефира версии

enter image description here

и как она выглядит в KitKat версии

enter image description here

вот мой код

MainActivity

private int counter = 0; 
private ShowcaseView showcaseView; 
Target t1,t2,t3; 
Button b1,b2,b3; 

@Override 
protected void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.activity_main); 


    t1 = new ViewTarget(R.id.button, this); 
    t2 = new ViewTarget(R.id.button2, this); 
    t3 = new ViewTarget(R.id.button3, this); 

    showcaseView = new ShowcaseView.Builder(this) 
      .setTarget(Target.NONE).setOnClickListener(this) 
      .setContentTitle("Title") 
      .setContentText("Here you can see the Showcase text") 
      .build(); 
    showcaseView.setButtonText("Next"); 
} 

@Override 
public void onClick(View v) { 
    switch (counter) { 
     case 0: 
      showcaseView.setShowcase(t1, true); 
      showcaseView.setContentTitle("Button 1"); 
      showcaseView.setContentText("See function about the button one"); 
      break; 
     case 1: 
      showcaseView.setShowcase(t2, true); 
      showcaseView.setContentTitle("Button 2"); 
      showcaseView.setContentText("See function about the button Two"); 
      break; 
     case 2: 
      showcaseView.setShowcase(t3, true); 
      showcaseView.setContentTitle("Button 3"); 
      showcaseView.setContentText("See function about the button THREE"); 
      showcaseView.setButtonText("GOT IT"); 
      break; 
     case 3: 
      showcaseView.hide(); 
      break; 
    } 
    counter++; 
} 

}

, как я могу это исправить

ответ

0

я получил ответ,

установить позицию расположения кнопки версии сборки выше 21

if (Build.VERSION.SDK_INT >= 21) { 
       showcaseView.setButtonPosition(lps); 
      }