SonyTV上的Android列表适配器问题
这只发生在SonyTV box上。以下是屏幕截图: 前两项有一个角问题。我删除了可能导致此问题的代码,根据情况将图像设置为可见或不可见SonyTV上的Android列表适配器问题,android,listadapter,sony,Android,Listadapter,Sony,这只发生在SonyTV box上。以下是屏幕截图: 前两项有一个角问题。我删除了可能导致此问题的代码,根据情况将图像设置为可见或不可见 @Override public View getView(int position, View convertView, ViewGroup parent) { int right = 0, top = 0, bottom = 0; View view = convertView; ViewHolde
@Override
public View getView(int position, View convertView, ViewGroup parent) {
int right = 0, top = 0, bottom = 0;
View view = convertView;
ViewHolder holder;
if (view == null) {
view = mInflater.inflate(R.layout.forecast_item, null);
LayoutParams lp = (LayoutParams)view.getLayoutParams();
lp = new LayoutParams(LayoutParams.MATCH_PARENT, mHeight);
holder = new ViewHolder();
holder.dateText = (TextView)view.findViewById(R.id.forecastDateText);
holder.dayText = (TextView)view.findViewById(R.id.forecastDayText);
holder.img = (ImageView)view.findViewById(R.id.forecastItemIcon);
holder.realfeelText = (TextView)view.findViewById(R.id.forecastReelFeelText);
holder.temperatureText = (TextView)view.findViewById(R.id.forecastHiLoTemp);
// holder.alarmIcon = (ImageView)view.findViewById(R.id.alarm_img);
holder.hiLoLabel = (TextView)view.findViewById(R.id.forecastHiLoLabel);
view.setTag(holder);
view.setLayoutParams(lp);
} else {
holder = (ViewHolder)view.getTag();
}
ForecastModel f = mForecastList.get(position);
holder.dayText.setText(f.name);
Utilities.resizeText(mBaseSize, mResizeFactor, 8, holder.dayText);
holder.dateText.setText(Utilities.doDateConversion(f.date, mWd));
String iconBuf = (f.iconCode.length() == 1) ? "0" + f.iconCode : f.iconCode;
holder.img.setImageResource(Utilities.getDrawableId("icon_" + iconBuf));
holder.temperatureText.setText(f.high + DEG + "/" + f.low + DEG);
holder.realfeelText.setText(f.reelfeelhigh + DEG + "/" + f.reelfeellow + DEG);
holder.hiLoLabel.setVisibility(mContext.getResources().getConfiguration().locale.getLanguage().contains(ENGLISH)
? View.VISIBLE : View.INVISIBLE);
// if (position < 3 && Alarms.hasAlarm(mWd.getCurrentWeatherDataModel(), f)){
// holder.alarmIcon.setVisibility(View.VISIBLE);
// } else holder.alarmIcon.setVisibility(View.GONE);
...
return view;
}
@覆盖
公共视图getView(int位置、视图转换视图、视图组父视图){
int right=0,top=0,bottom=0;
视图=转换视图;
视窗座;
如果(视图==null){
view=mInflater.充气(R.layout.forecast\u项,空);
LayoutParams lp=(LayoutParams)视图。getLayoutParams();
lp=新的LayoutParams(LayoutParams.MATCH_父项,mHeight);
holder=新的ViewHolder();
holder.dateText=(TextView)view.findViewById(R.id.forecastDateText);
holder.dayText=(TextView)view.findViewById(R.id.forecastDayText);
holder.img=(ImageView)view.findViewById(R.id.forecastItemIcon);
holder.realfeelText=(TextView)view.findViewById(R.id.forecastereelfeeltext);
holder.temperatureText=(TextView)view.findViewById(R.id.forecashilotemp);
//holder.alarmIcon=(ImageView)view.findViewById(R.id.alarm\u img);
holder.hiLoLabel=(TextView)view.findViewById(R.id.forecashiloLabel);
视图.设置标签(支架);
view.setLayoutParams(lp);
}否则{
holder=(ViewHolder)view.getTag();
}
ForecastModel f=mForecastList.get(位置);
holder.dayText.setText(f.name);
实用程序.resizeText(mBaseSize,mResizeFactor,8,holder.dayText);
holder.dateText.setText(实用程序.doDateConversion(f.date,mWd));
字符串iconBuf=(f.iconCode.length()==1)?“0”+f.iconCode:f.iconCode;
holder.img.setImageResource(Utilities.getDrawableId(“icon_u“+iconBuf));
保持架温度文字设定文字(f.高+度+“/”+f.低+度);
保持架realfeelText.setText(f.reelfeelhigh+DEG+“/”+f.reelfeellow+DEG);
holder.hiLoLabel.setVisibility(mContext.getResources().getConfiguration().locale.getLanguage().contains(英语)
?视图。可见:视图。不可见);
//if(位置<3&&Alarms.hasAlarm(mWd.getCurrentWeatherDataModel(),f)){
//holder.alarmIcon.setVisibility(视图可见);
//}else holder.alarmIcon.setVisibility(View.GONE);
...
返回视图;
}
你知道为什么会发生这种情况吗?当电视设置为720p(而不是1080p)时,此功能有效。“小时”选项卡也是一个列表适配器,但它可以工作。您使用Accuweather电视应用程序吗?很好。我确实这么做了……除了SonyTV电视台,这段代码对所有的电视台都有效。“所有”到目前为止:)