我的复选框在选中时使用“createCircularReveal”进行显示效果 - 在L预览中效果很好,但现在不能使用Lollipop SDK。没有错误被抛出,我无法弄清楚原因。我在列表视图项上执行此操作。
这是ListView.java片段。
@Override
public View getView(int position, View view, ViewGroup parent) {
LayoutInflater inflater = context.getLayoutInflater();
View rowView= inflater.inflate(R.layout.skate_player_listrow_item, null, true);
final View layoutSkate_Container = (View) rowView.findViewById(R.id.layoutSkate_Container);
final CheckBox checkSKATE_S = (CheckBox) rowView.findViewById(R.id.btn_radio_skate_s);
final TextView txtSkate_PlayerName = (TextView) rowView.findViewById(R.id.txtSkate_PlayerName);
checkSKATE_S.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
checkSKATE_S.setEnabled(false);
checkSKATE_K.setEnabled(true);
checkSKATE_S.setTextColor(context.getResources().getColor(R.color.white));
int cx = (checkSKATE_S.getLeft() + checkSKATE_S.getRight()) / 2;
int cy = (checkSKATE_S.getTop() + checkSKATE_S.getBottom()) / 2;
int finalRadius = checkSKATE_S.getWidth();
Animator anim = ViewAnimationUtils.createCircularReveal(checkSKATE_S, cx, cy, 0, finalRadius);
anim.start();
}
});
}
我知道它正在开火,因为文字会改变颜色。这是复选框的drawable。
<item android:state_checked="true">
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<corners
android:radius="8dp" />
<solid
android:color="@color/green" />
</shape>
</item>
<item android:state_checked="false">
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<solid
android:color="@color/transparent_color" />
</shape>
</item>
和复选框xml
<CheckBox
android:layout_width="0px"
android:includeFontPadding="false"
android:layout_weight="20"
android:layout_height="match_parent"
android:id="@+id/btn_radio_skate_s"
android:button="@android:color/transparent"
android:background="@drawable/btn_checkstyle_skate"
android:text="S"
android:fontFamily="sans-serif-thin"
android:textSize="50dp"
android:gravity="center"
android:textColor="@color/grey"
android:layout_marginRight="8dp"
android:checked="false"/>
谢谢你们,感谢任何帮助。