我如何在我的图书馆用户中创建一个EditText视图,该视图的getText()方法对我的图书馆用户不可见?

问题描述 投票:0回答:1

我有一个具有CustomEditText(从AppCompatEditText扩展的)类的android库,出于某些安全原因,我不希望我的库用户访问在CustomEditText中键入的文本。我该如何实现?

android android-edittext android-custom-view
1个回答
0
投票

您不能reduce the visibility of an inherited method,因此getText()将必须停留在public

但是您可以重写它以不返回任何有意义的内容,并提供库类可以使用的受程序包保护的方法。

© www.soinside.com 2019 - 2024. All rights reserved.