ラベル VisibilityAwareImageButton.setVisibility can only be called from within the same library group の投稿を表示しています。 すべての投稿を表示
ラベル VisibilityAwareImageButton.setVisibility can only be called from within the same library group の投稿を表示しています。 すべての投稿を表示

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

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

build.gradle(Module: app)でこのエラーに関すると思われるものは以下:
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メソッドを使えば、エラーを回避できる.
floatingActionButton.show();
floatingActionButton.hide();

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

参考にしたサイト



FloatingActionButtonをスクロール中に消す

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