我使用SlidingPaneLayout工作。讓我知道這個是否奏效。 ![enter image description here](https://i.stack.imgur.com/hCeyd.gif)
XML
<android.support.v4.widget.SlidingPaneLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/SlidingPanel"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:id="@+id/base"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#2196F3"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:text="Hello SlidingPaneLayout!" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/slider"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="20dp"
android:background="#F44336"
android:elevation="50dp">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:text="Hello SlidingPaneLayout!" />
</RelativeLayout>
</android.support.v4.widget.SlidingPaneLayout>
活動
import android.os.Bundle;
import android.support.v4.content.ContextCompat;
import android.support.v4.widget.SlidingPaneLayout;
import android.support.v7.app.AppCompatActivity;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
SlidingPaneLayout slidingPaneLayout = (SlidingPaneLayout) findViewById(R.id.SlidingPanel);
slidingPaneLayout.setSliderFadeColor(ContextCompat.getColor(this, android.R.color.transparent));
slidingPaneLayout.openPane();
}
}
喜歡的東西[使用ViewPager絲網幻燈片](http://developer.android.com/training/animation/screen-slide.html) ? –
你想能夠在當前視圖上刷卡嗎? –