2012-02-09 14 views
1

でGardientアニメーションは、これはスタート画面です:タブがアクティブに、そしてタブが去ったときの輝きを減少しているとき アンドロイド:私のアプリの起動時にタブレイアウト

enter image description here

は私が増加輝きをしたいです。

これは私のセレクタファイルです:アプリが起動しアクティブにタブが輝きを持っていないとき

<?xml version="1.0" encoding="utf-8"?> 

<animation-list xmlns:android="http://schemas.android.com/apk/res/android" 
android:oneshot="true" android:visible="true" > 
<item 
    android:drawable="@drawable/phase1" 
    android:duration="20" /> 
<item 
    android:drawable="@drawable/phase2" 
    android:duration="20" />  
<item 
    android:drawable="@drawable/phase3" 
    android:duration="20" />  
<item 
    android:drawable="@drawable/phase4" 
    android:duration="20" />  
    <item 
    android:drawable="@drawable/phase5" 
    android:duration="20" />  
    <item 
    android:drawable="@drawable/phase6" 
    android:duration="20" />  
    <item 
    android:drawable="@drawable/phase7" 
    android:duration="20" />  
    <item 
    android:drawable="@drawable/phase8" 
    android:duration="20" />  
    <item 
    android:drawable="@drawable/phase9" 
    android:duration="20" />  
    <item 
    android:drawable="@drawable/phase10" 
    android:duration="20" />  
    <item 
    android:drawable="@drawable/phase11" 
    android:duration="20" /> 
    <item 
    android:drawable="@drawable/phase12" 
    android:duration="20" /> 

問題で、この私のアニメーションファイルですが

<?xml version="1.0" encoding="utf-8"?> 
<selector xmlns:android="http://schemas.android.com/apk/res/android"> 
<!-- Non focused states --> 
<item android:state_focused="false" 
     android:state_selected="false" 
     android:state_pressed="false" 
     android:drawable="@drawable/reverse_animation" /> 
<item android:state_focused="false" 
     android:state_selected="true" 
     android:state_pressed="false" 
     android:drawable="@drawable/animation" /> 

<!-- Focused states --> 
<item android:state_focused="true" 
     android:state_selected="false" 
     android:state_pressed="false" 
     android:drawable="@drawable/animation" /> 
<item android:state_focused="true" 
     android:state_selected="true" 
     android:state_pressed="false" 
     android:drawable="@drawable/animation" /> 

<!-- Pressed --> 
<item android:state_pressed="true" 
     android:drawable="@drawable/pressed" /> 

他の2つのタブには輝きがあります。

私は各フェーズファイルでグラデーションを使用し、それぞれに半径を増やしました。 は、私はこれは、フェーズ1で

をPHASE1するphase12で始まるreverse_animationファイルで:

<?xml version="1.0" encoding="utf-8"?> 
<shape xmlns:android="http://schemas.android.com/apk/res/android"  
android:shape="rectangle" > 

<gradient 
    android:type="radial" 
    android:gradientRadius="1" 
    android:startColor="#DD02e4ff" 
    android:centerY="-0.16" /> 

</shape> 

私はタブのデフォルト設定の助けを必要としてください。 [オーディオ]タブは、他のタブではなく、明るくなるはずです。私はセレクタファイルで非常に多くの可能な組み合わせを試しましたが、これを達成することはできません。ありがとう!

答えて

1
  1. android:visible="true"animation-listに表示がありません:here
  2. android:gradientRadius="1"はかなり小さいですが。それはあなたの形状の上に移動している単一のドットです(android:centerY="-0.16")。勾配障害であるかどうかをテストしたり、半径をより大きな値に設定したりするには、<solid android:color="#FF00FF00" />を試してみてください。
  3. 回避方法:AlphaAnimationでtween-animationを作成し、グラデーション描画可能にします。
関連する問題