VisibilityAwareImageButton.setVisibility can only be called from within the same library group

sdkのバージョンを28 beta1に変えてみると、android.support.design.widget.FloatingActionButton.setVisiblityメソッドを使っていたときに次のようなエラーが出た.
エラーメッセージ
1
VisibilityAwareImageButton.setVisibility can only be called from within the same library group (groupId=com.android.support)

build.gradle(Module: app)でこのエラーに関すると思われるものは以下:
環境
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
apply plugin: 'com.android.application'
 
android {
    compileSdkVersion 28
    defaultConfig {
        ...
        targetSdkVersion 28
        ...
    }
    ...
}
 
dependencies {
    implementation 'com.android.support:design:28.0.0-beta01'
    ...
}

雑に言えば、FloatingActionButtonvisibilityを直接変えてはいけないようである. setVisiblityの代わりにshowメソッドかhideメソッドを使えば、エラーを回避できる.
1
2
floatingActionButton.show();
floatingActionButton.hide();

ただし、この場合、FloationActionButtonvisibilityinvisibleにすることは工夫をしないとできないようである.

参考にしたサイト



FloatingActionButtonをスクロール中に消す

NestedScrollView を下にスクロールしている間は, FloatingActionButton を表示させないようにする. 少し変えれば, RecyclerView 等の他のScrollViewにも使えそう(未確認). 下に実際の挙動を示した. 目次 ...