Butterknife.findById()比findViewById()更好吗?

时间:2016-02-12 01:03:49

标签: android android-layout findviewbyid butterknife

使用 SELECT VendorName AS [Vendor], InvoiceDate AS [Date], InvoiceNumber AS [Number], AccountItemDescription AS [Description] FROM Vendors AS v JOIN Invoices AS i ON v.VendorID = i.InvoiceID JOIN InvoiceLineItems AS l JOIN GLAccounts AS g WHERE l.InvoiceLineItems = g.GLAccounts ORDER BY Vendor, Description;-- Unfinished 与使用ButterKnife.findById()相比,使用findViewById()提供了哪种性能提升?我猜不了 - 这只是为了简化代码而做的。

1 个答案:

答案 0 :(得分:3)

如果您查看source code,它就会为您执行类型转换。所以它更干净,但同样高效。

return (T) view.findViewById(id);