我是android新手 请大家多多指教 有砖轻拍~
在java中我试了interface 是不能implements interface的
我想当然认为android也不行
可是今天查api发现了一个类叫
public interface ListAdapter implements Adapter
不明白 请高人指点啊~~~~
在java中我试了interface 是不能implements interface的
我想当然认为android也不行
可是今天查api发现了一个类叫
public interface ListAdapter implements Adapter
不明白 请高人指点啊~~~~
* Extended {@link Adapter} that is the bridge between a {@link ListView}
* and the data that backs the list. Frequently that data comes from a Cursor,
* but that is not
* required. The ListView can display any data provided that it is wrapped in a
* ListAdapter.
*/
public interface ListAdapter extends Adapter { /**
* Are all items in this ListAdapter enabled?
* If yes it means all items are selectable and clickable.
*
* @return True if all items are enabled
*/
public boolean areAllItemsEnabled(); /**
* Returns true if the item at the specified position is not a separator.
* (A separator is a non-selectable, non-clickable item).
*
* The result is unspecified if position is invalid. An {@link ArrayIndexOutOfBoundsException}
* should be thrown in that case for fast failure.
*
* @param position Index of the item
* @return True if the item is not a separator
*/
boolean isEnabled(int position);
}源码的确是继承自Adpter.接口可以继承接口,但不知道能不能实现接口。java中接口可以继承接口吗?
java中不允许类多重继承的主要原因是:如果A同时继承B和C,而假如B和C同时有一个d方法,A如何决定该继承哪一个呢?
但接口不存在这样的问题,接口中全都是抽象方法,继承谁都无所谓,所以接口可以继承多个接口。
interface b{}
interface c{}
interface a extends b,c{}//对