setItemsCanFocus(true)
android:focusable="true
package com.cn21.ecloud.tv.ui.widget;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.widget.RelativeLayout;
public class SelectedRelativeLayout extends RelativeLayout{
private Drawable mFloatDrawable;
private Rect mTempRect = new Rect();
public SelectedRelativeLayout(Context context) {
this(context, null, 0);
}
public SelectedRelativeLayout(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public SelectedRelativeLayout(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
mFloatDrawable = getResources().getDrawable(R.drawable.item_float_rectangle);
}
@Override
protected void dispatchDraw(Canvas canvas) {
super.dispatchDraw(canvas);
if (hasFocus()) {
if (mFloatDrawable != null) {
final int w = getMeasuredWidth();
final int h = getMeasuredHeight();
mFloatDrawable.getPadding(mTempRect);
mFloatDrawable.setBounds(-mTempRect.left, -mTempRect.top,
w + mTempRect.right, h + mTempRect.bottom);
mFloatDrawable.draw(canvas);
}
}
}
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有