android t类型参数,类型参数T是隐藏类型T(The type parameter T is hiding the typ

我的问题是:为什么,如果我使用的LinearLayout,而不是Object ,作为我的“结果” AsyncTask ( TableWithinExpListTask中给我许多错误,如无法实例类型的LinearLayout?

在我看来,它并不能识别LinearLayout在了createFormattedCell()我不能undertstand原因。

在AsyncTask声明LinearLayout有黄色下划线和Eclipse说: 类型参数的LinearLayout是隐藏式的LinearLayout。

请有人可以解释这样对我?

下面是类的代码:

import android.content.Context;

import android.graphics.Color;

import android.graphics.Typeface;

import android.os.AsyncTask;

import android.view.View;

import android.widget.LinearLayout;

import android.widget.TextView;

public class TableWithinExpListTask extends AsyncTask {

private final int TABLE_BORDER = 1;

private final int TABLE_TEXT_PADDING = 10;

private Context context = null;

private String str = null;

private boolean tableHeader = false;

private LinearLayout column = null;

public TableWithinExpListTask(Context context, String str, boolean tableHeader, LinearLayout column) {

this.context = context;

this.str = str;

this.tableHeader = tableHeader;

this.column = column;

}

@Override

protected LinearLayout doInBackground(Params... arg0) {

return this.createFormattedCell(this.tableHeader, this.str);

}

@Override

protected void onPostExecute(LinearLayout result) {

this.column.addView(result);

}

private LinearLayout createFormattedCell(boolean tabHeader, String str) {

// Layout che circonda le textView necessario per disegnare il bordo

// delle celle

LinearLayout container = new LinearLayout(this.context);

container.setPadding(TABLE_BORDER, TABLE_BORDER, 0, 0);

container.setBackgroundColor(Color.BLACK);

TextView textView = new TextView(this.context);

textView.setPadding(TABLE_TEXT_PADDING, TABLE_TEXT_PADDING, TABLE_TEXT_PADDING, TABLE_TEXT_PADDING);

textView.setBackgroundColor(Color.WHITE);

LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,

LinearLayout.LayoutParams.MATCH_PARENT);

textView.setLayoutParams(params);

if (tabHeader) {

textView.setTypeface(Typeface.DEFAULT_BOLD);

textView.setBackgroundColor(this.context.getResources().getColor(R.color.light_grayish_orange));

}

textView.setText(str);

container.addView(textView);

return container;

}

}

我看到这个其他的问题,但我不完全理解在这种情况下这种行为。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值