0
Androidの現在のビューの上をスライドするスライダを作成しようとしています。ここにあるSlideUpライブラリを使ってスライダを構築しましたhttps://github.com/mancj/SlideUp-Android。スライダは内側のRelativeLayoutをビューソースとして取得しています。スライダーを引き上げると、CardViewの後ろで終わります。ライブラリのすべてのメソッドを調べましたが、スライダをフォアグラウンドに移動することはできません。私はまた、.bringToFront()
メソッドでスライダビューをフォアグラウンドに持ってきてみました。 .xmlファイル内のCardViewが何もしない前にスライダビューを移動する。スライダを前景に持っていくか、背景にCardViewを置くのがいいですか?スライダ要素をCardViewの上にオーバーレイする
JAVA
//code to build slider
View slideView = findViewById(R.id.slider);
//tried putting slideView.bringToFront() here before passing it to the object but that did nothing
SlideUp slideUp = new SlideUpBuilder(slideView)
.withStartState(SlideUp.State.HIDDEN)
.withStartGravity(Gravity.BOTTOM)
.build();
//code to bring up slider. View "share" exists, it's just irrelevant so I didn't include in the .xml file
buttonView.findViewById(R.id.share).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
//tried putting slideView.bringToFront() here as well
slideUp.toggle(); //toggles slider up/down
}
});
XML
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:background="@color/background"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginRight="5dp"
android:layout_marginLeft="5dp"
android:layout_marginTop="20dp"
android:layout_marginBottom="60dp">
</android.support.v7.widget.CardView>
<RelativeLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/slider"
android:background="@color/primary">
</RelativeLayout>
</RelativeLayout>