2014-09-23 87 views
0

我想在框架佈局下出現的水平滾動視圖中設置我的ImageButtons。以下是我迄今爲止所做的。但是,這會滾動一切,包括我的框架佈局。我如何避免這種情況?或者以另一種方式來看待它,我試圖拿着我的導航抽屜放下它而不是從側面冒出來?也許有一種方法來複制呢?總體目標是獲得與舊版黑莓滾動菜單類似的內容。Horizo​​ntalScrollView相對佈局

<android.support.v4.widget.DrawerLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:id="@+id/drawer_layout" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    tools:context=".DMActivity"> 
    <HorizontalScrollView 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent"> 
    <RelativeLayout 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:orientation="vertical" 
     android:gravity="center"> 
     <FrameLayout 
      android:id="@+id/container" 
      android:layout_width="match_parent" 
      android:layout_height="900px"></FrameLayout> 
     <ImageButton 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_below="@+id/container" 
      android:src="@drawable/directmessage_button" 
      android:id="@+id/btn_DirectMessages" 
      android:background="#0000" 
      android:padding="20px" 
      android:focusableInTouchMode="false" /> 
     <ImageButton 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_below="@+id/container" 
      android:src="@drawable/instantmessage_button" 
      android:id="@+id/btn_InstantMessage" 
      android:layout_toRightOf="@+id/btn_DirectMessages" 
      android:background="#0000" 
      android:padding="20px" 
      android:focusableInTouchMode="false"/> 
     <ImageButton 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_below="@+id/container" 
      android:layout_toRightOf="@+id/btn_InstantMessage" 
      android:src="@drawable/reports_button" 
      android:id="@+id/btn_Reports" 
      android:background="#0000" 
      android:padding="20px" 
      android:focusableInTouchMode="false"/> 
     <ImageButton 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:src="@drawable/conference_button" 
      android:id="@+id/btn_Conference" 
      android:layout_toRightOf="@+id/btn_Reports" 
      android:layout_below="@+id/container" 
      android:background="#0000" 
      android:padding="20px" 
      android:focusableInTouchMode="false"/> 
     <ImageButton 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:src="@drawable/account_button" 
      android:id="@+id/btn_Account" 
      android:layout_toRightOf="@id/btn_Conference" 
      android:layout_below="@+id/container" 
      android:background="#0000" 
      android:padding="20px"/> 
     <ImageButton 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:src="@drawable/filetransfer_button" 
      android:id="@+id/btn_FileTransfer" 
      android:layout_below="@id/container" 
      android:layout_toRightOf="@+id/btn_Account" 
      android:background="#0000" 
      android:padding="20px"/> 
    </RelativeLayout> 
</HorizontalScrollView> 
    <fragment android:id="@+id/navigation_drawer" 
     android:layout_width="@dimen/navigation_drawer_width" 
     android:layout_height="match_parent" 
     android:layout_gravity="start" 
     android:name="datamotion.dmandroidclient.NavigationDrawerFragment" 
     tools:layout="@layout/fragment_navigation_drawer" /> 
</android.support.v4.widget.DrawerLayout> 

回答

0

我不知道我的理解很好,但我用這個庫做橫向滾動,就可以實現這個水平ListView和裏面把你ImageButtons就像你要做一個垂直的ListView做。

https://github.com/sephiroth74/HorizontalVariableListView

希望它可以幫助你。

+0

嗨,感謝您的迴應,這和Horizo​​ntalScrollView有什麼區別? – Kyle 2014-09-23 16:15:10

+0

不客氣。這就像一個普通的ListView,但水平的,這將讓你水平滾動只是在這個水平的ListView裏面的項目 – 2014-09-23 16:22:14

+0

好吧,這將是非常好的。好吧,我會給它一個機會... – Kyle 2014-09-23 19:28:47

相關問題