自訂抽屜,iphone自訂鈴聲

來源:互聯網
上載者:User

自訂抽屜,iphone自訂鈴聲

轉載註明出處:http://blog.csdn.net/forwardyzk/article/details/42557355

系統內建的SlidingDrawer,只提供了兩個方向的滑動:從下到上,從右至左。下面介紹四個方向都可以滑動的抽屜控制項。

自訂控制項,包含自訂屬性,可以制定方向。leftToRight,bottomToTop,rightToLeft,topToBottom

handle.xml

<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:layout_width="wrap_content"    android:layout_height="wrap_content" >    <TextView        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:background="@android:color/white"        android:gravity="center"        android:padding="10dp"        android:text="拉手"        android:textColor="@color/handle"        android:textSize="30sp" /></RelativeLayout>

content.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="match_parent"    android:layout_gravity="bottom" >    <TextView        android:layout_width="match_parent"        android:layout_height="match_parent"        android:background="@color/content"        android:gravity="center"        android:text="抽屜內容"        android:textColor="@android:color/black" /></RelativeLayout>


main.xml

<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:layout_width="fill_parent"    android:layout_height="fill_parent"    android:background="@android:color/white"    android:orientation="vertical" >    <com.example.demoslidingdrawer.view.MultiDirectionSlidingDrawer        xmlns:my="http://schemas.android.com/apk/res/com.example.demoslidingdrawer"        android:layout_width="match_parent"        android:layout_height="wrap_content"        my:content="@+id/content"        my:direction="topToBottom"        my:handle="@+id/handle" >        <include            android:id="@id/content"            layout="@layout/content" />        <include            android:id="@id/handle"            layout="@layout/handle" />    </com.example.demoslidingdrawer.view.MultiDirectionSlidingDrawer>    <com.example.demoslidingdrawer.view.MultiDirectionSlidingDrawer        xmlns:my="http://schemas.android.com/apk/res/com.example.demoslidingdrawer"        android:layout_width="match_parent"        android:layout_height="wrap_content"        my:content="@+id/content"        my:direction="rightToLeft"        my:handle="@+id/handle" >        <include            android:id="@id/content"            layout="@layout/content" />        <include            android:id="@id/handle"            layout="@layout/handle" />    </com.example.demoslidingdrawer.view.MultiDirectionSlidingDrawer>    <com.example.demoslidingdrawer.view.MultiDirectionSlidingDrawer        xmlns:my="http://schemas.android.com/apk/res/com.example.demoslidingdrawer"        android:layout_width="match_parent"        android:layout_height="wrap_content"        my:content="@+id/content"        my:direction="bottomToTop"        my:handle="@+id/handle" >        <include            android:id="@id/content"            layout="@layout/content" />        <include            android:id="@id/handle"            layout="@layout/handle" />    </com.example.demoslidingdrawer.view.MultiDirectionSlidingDrawer>    <com.example.demoslidingdrawer.view.MultiDirectionSlidingDrawer        xmlns:my="http://schemas.android.com/apk/res/com.example.demoslidingdrawer"        android:layout_width="match_parent"        android:layout_height="wrap_content"        my:content="@+id/content"        my:direction="leftToRight"        my:handle="@+id/handle" >        <include            android:id="@id/content"            layout="@layout/content" />        <include            android:id="@id/handle"            layout="@layout/handle" />    </com.example.demoslidingdrawer.view.MultiDirectionSlidingDrawer></RelativeLayout>

自訂屬性控制項,請參考:http://blog.csdn.net/forwardyzk/article/details/25079743

源碼下載:http://download.csdn.net/detail/forwardyzk/8345333
:



聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.