开发者

Java: Succinct way to import multiple constants

Is there a succinct way to import in Java which would be equivalent to the following statement:

import static android.view.View.GONE;
import static android.view.View.INVISIBLE; 
import static android.view.View.VISIBLE;

I know about this:

import android.view.View.*;

But I would like to be able to control what I import, and开发者_JS百科 not just import everything in the View namespace.

ANSWER: The answer is No.


No, there's no quicker way to only import some constants. You can get them all, or you can list each one you want separately.


Actually there is technically a third option, not that it's necessarily better. You do have the option to import none of them and use their fully qualified name each time you refer to them.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜