2016-03-19 11 views
1

アルファの背景を持つドロップ可能リストのように動作するAndroidでビューを作成するにはどうすればよいですか? はたぶん、このグラフィックは理解するのに役立ちます:CLICKAndroid - リスト付きの作成可能なビュー

は、だから私は「MY VIEW」とその下のいくつかのレイアウトコントロールを持って、私は「MY VIEW」の背景のアルファを持つダウンリストが表示されますドラッグします。どんなコントロール/多分ライブラリを使うことができますか? これはシステムバーと同様の操作です。 @EDIT

: これは私がしようとしたものです: は、私はそれが「MEをスクロール」ボタンを持っている一番下に、RelativeViewでXMLを作る:

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:background="#000000" 
    android:orientation="vertical"> 

    <TextView 
     android:id="@+id/textView" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignLeft="@+id/textView3" 
     android:layout_alignStart="@+id/textView3" 
     android:layout_below="@+id/button3" 
     android:layout_gravity="center_horizontal" 
     android:layout_marginBottom="30dp" 
     android:layout_marginTop="30dp" 
     android:text="SCROLL ME" 
     android:textAppearance="?android:attr/textAppearanceMedium" 
     android:textColor="#ffffff" /> 

    <TextView 
     android:id="@+id/textView2" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentTop="true" 
     android:layout_centerHorizontal="true" 
     android:text="Small Text" 
     android:textAppearance="?android:attr/textAppearanceSmall" 
     android:textColor="#ffffff" /> 

    <RadioButton 
     android:id="@+id/radioButton" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_below="@+id/textView2" 
     android:layout_centerHorizontal="true" 
     android:text="New RadioButton" 
     android:textColor="#ffffff" /> 

    <TextView 
     android:id="@+id/textView3" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_below="@+id/radioButton" 
     android:layout_centerHorizontal="true" 
     android:text="Large Text" 
     android:textAppearance="?android:attr/textAppearanceLarge" /> 

    <Button 
     android:id="@+id/button3" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_below="@+id/textView3" 
     android:layout_centerHorizontal="true" 
     android:text="New Button" /> 
</RelativeLayout> 

次は私が持つアクティビティレイアウトにこれを追加するには、次のとおりです

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior" 
    tools:context="com.android.fragmenttest.MainActivity" 
    tools:showIn="@layout/activity_main"> 

    <Button 
     android:id="@+id/button" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentEnd="true" 
     android:layout_alignParentLeft="true" 
     android:layout_alignParentRight="true" 
     android:layout_alignParentStart="true" 
     android:layout_alignParentTop="true" 
     android:text="New Button" /> 

    <Button 
     android:id="@+id/button2" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_below="@+id/include" 
     android:layout_centerHorizontal="true" 
     android:text="New Button" /> 

    <include 
     android:id="@+id/include" 
     layout="@layout/fragmentitem" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentEnd="true" 
     android:layout_alignParentLeft="true" 
     android:layout_alignParentRight="true" 
     android:layout_alignParentStart="true" 
     android:layout_below="@+id/button" 
     android:layout_marginTop="-130dp" /> 

    <Button 
     android:id="@+id/button4" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignLeft="@+id/button2" 
     android:layout_alignParentBottom="true" 
     android:layout_alignStart="@+id/button2" 
     android:layout_marginBottom="62dp" 
     android:text="New Button" /> 
</RelativeLayout> 

あなたは私、これは-margin値を持つ含ま見ることができるように、今私はそれをドラッグしたい、と私は、全体の高さを含んでドラッグすると、それはアルファ背景を持つ全画面に表示されます(リストで2番目のビューが表示されますアルファとの最初のビューで)。

+0

同様の目的のためにポップアップウィンドウを使用? –

+0

黒いボタン「MY VIEW」を下にしてLinearLayoutを作成してみましたが、マイナスマージンで追加しましたが動作しません。 – taulus

+0

何か試してもあなたのXMLコードを投稿してください。 –

答えて

関連する問題