1
我有一個View
和我想要閃爍特定時間的邊框。我試圖讓閃爍,但問題是整個視圖閃爍。我知道它的細節我在裏面提到了View
這個背景設置爲邊框。視圖的閃爍邊框
下面是代碼:
xml:
<LinearLayout
android:layout_width="14dp"
android:layout_height="14dp
android:id="@+id/rect2"
android:background="@drawable/cir"
>
<View
android:layout_width="5dp"
android:layout_height="5dp"
android:background="#14FFFFFF"
android:layout_marginTop="3dp"
android:layout_marginLeft="3dp"
android:id="@+id/inrect2"
/>
</LinearLayout>
的java:
//somecode
setContentView(R.layout.activity_main);
re2=(LinearLayout)findViewById(R.id.rect2);
myView2= findViewById(R.id.inrect2);
((GradientDrawable)re1.getBackground()).setStroke(1,Color.WHITE);
AlphaAnimation blinkanimation= new AlphaAnimation(1, 0); // Change alpha from fully visible to invisible
blinkanimation.setDuration(500); // duration - half a second
blinkanimation.setInterpolator(new LinearInterpolator()); // do not alter animation rate
blinkanimation.setRepeatCount(28); // Repeat animation infinitely
blinkanimation.setRepeatMode(Animation.REVERSE);
re1.startAnimation(blinkanimation);
re1.startAnimation(blinkanimation)
似乎開始動畫整個線性佈局,反正我有可以閃爍僅邊界? 任何幫助,將不勝感激!謝謝!
編輯的代碼,是的,我已經填充,我可以看到在XML中的視圖的外線。問題是我如何只動畫Linearlayout而不是在裏面查看? –
我看到了,然後使用framelayout將視圖堆疊在linearlayout的頂部,並檢查它是否有效。 –
WOW ..你剛剛擁有它!謝了哥們!很好的工作 –