ScrollView在抽屉布局中不起作用。我已经将滚动条放入导航视图中,但是它不起作用

时间:2019-06-07 09:32:51

标签: android xamarin xamarin.android

ScrollView在抽屉布局中不起作用。我已经将滚动条放入导航视图中,但是它不起作用。 在下面的代码中,HomeView.cs是用于显示抽屉布局的View。 SliderView.cs是抽屉的布局。我已经使用listview在导航抽屉中显示菜单。但是它不起作用

我已经选择了帧布局,因为我想显示片段内部。

    //HomeView.axml
    <?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"
    android:layout_width="match_parent"
    android:background="@color/colorWhite"
    android:id="@+id/rootLayout"
    android:layout_height="wrap_content">
    <ImageView 
        android:layout_height="match_parent"
        android:src="@drawable/back_radient"
        android:id="@+id/bluryImg"
        android:visibility="gone"
        android:scaleType="centerCrop"
        android:layout_width="match_parent"/>
    <RelativeLayout 
        android:visibility="visible"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/NotificationDrawerLayout"
        android:background="#37CADD">
       <RelativeLayout 
            android:layout_width="match_parent"
            android:background="#37CADD"
            android:padding="10dp"
            android:id="@+id/notificationDrawerBarLayout"
            android:minHeight="50dp"
            android:layout_height="wrap_content">
        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textSize="@dimen/textSize_15"
            android:id="@+id/NotificationDrawerText"
            android:textColor="#ffffff"
            android:textStyle="normal"
            android:gravity="center"
            android:layout_centerInParent="true"
            android:text="Composition Created Successfully" />
        </RelativeLayout>
</RelativeLayout>

   <android.support.v4.widget.DrawerLayout
        android:id="@+id/drawer"
        android:visibility="visible"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

   <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent">
            <include
                android:id="@+id/headerLayout"
                layout="@layout/HeaderView"
                android:layout_alignParentTop="true" />       
               <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:id="@+id/contentFrameRootLayout"
                android:layout_below="@+id/headerLayout">
                <FrameLayout
                    android:id="@+id/content_frameLayout"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent" />
            </RelativeLayout>
        </RelativeLayout>
        <FrameLayout
            android:id="@+id/navigation_frame"
            android:layout_height="match_parent"
            android:layout_width="wrap_content"
            android:layout_gravity="left|start" />
    </android.support.v4.widget.DrawerLayout>

</RelativeLayout>

 //SliderView.axml

      <?xml version="1.0" encoding="utf-8"?>
      <ScrollView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/scroll"
        android:layout_width="match_parent"
    android:fillViewport="true"
        android:layout_height="match_parent">
    <LinearLayout  
        android:layout_width="wrap_content"
        android:orientation="vertical"
        android:layout_height="match_parent">
        <android.support.design.widget.NavigationView 
            android:id="@+id/navigation_view"

            android:layout_height="wrap_content"
            android:layout_width="wrap_content"
            android:background="@drawable/side_menu"
            android:layout_gravity="start">

              <RelativeLayout
                            android:layout_width="match_parent"
                            android:id="@+id/topSliderView"
                            android:layout_height="match_parent">

                             <LinearLayout 
                                android:layout_width="match_parent"
                                android:orientation="vertical"
                                android:layout_height="match_parent">
                               <RelativeLayout 
                                    android:layout_width="match_parent"
                                    android:layout_height="wrap_content">
                                    <ImageButton
                                    android:layout_width="wrap_content"
                                    android:layout_height="wrap_content"
                                    android:id="@+id/btnDrawerClose"
                                    android:layout_marginLeft="@dimen/margin_05"
                                    android:layout_marginTop="@dimen/margin_25"
                                    android:padding="@dimen/padding_10"
                                    android:src="@drawable/humbergerclose"
                                    android:background="@null"
                                    android:tint="#ffffff" />
                                    <refractored.controls.CircleImageView
                                    android:id="@+id/profile"
                                    android:layout_below="@+id/btnDrawerClose"
                                    android:layout_width="80dp"
                                    android:scaleType="centerCrop"
                                    android:layout_height="80dp"
                                    android:transitionName="EXTRA_IMAGE"
                                    android:src="@drawable/user2"
                                    app:civ_border_width="0dp"
                                    android:layout_centerHorizontal="true" />
                                    <TextView
                                    android:id="@+id/txtViewName"
                                    android:layout_width="match_parent"
                                    android:layout_below="@id/profile"
                                    android:layout_height="wrap_content"
                                    android:text="Darshan Prajpati"
                                    android:textSize="@dimen/textSize_16"
                                    android:textColor="@color/colorWhite"
                                    android:gravity="center_horizontal"
                                    android:layout_marginTop="@dimen/margin_10" />
                                    <TextView
                                    android:id="@+id/txtViewEmail"
                                    android:layout_width="match_parent"
                                    android:layout_below="@id/txtViewName"
                                    android:layout_height="wrap_content"
                                    android:text="dkprajpati18@gmail.com"
                                    android:textSize="@dimen/textSize_14"
                                    android:textColor="@color/colorWhite"
                                    android:gravity="center_horizontal"
                                    android:layout_marginTop="@dimen/margin_10" />
                                    <ListView
                                        android:id="@+id/menuItemListView"
                                        android:scrollbars="none"
                                        android:layout_marginTop="@dimen/margin_10"
                                        android:layout_width="match_parent"
                                        android:layout_below="@id/txtViewEmail"
                                        android:layout_height="wrap_content"           
                                        android:divider="@null" />
                                </RelativeLayout>
                                 <Space
                                    android:layout_width="match_parent"
                                    android:layout_height="0dp"
                                    android:layout_weight="1" />

                                 <RelativeLayout 
                                    android:layout_width="match_parent"
                                    android:layout_height="wrap_content">
                                    <RelativeLayout
                                            android:id="@+id/setting2ItemLayout"
                                            android:layout_height="49dp"
                                            android:layout_width="match_parent"
                                            android:layout_marginLeft="@dimen/margin_20"
                                            android:padding="@dimen/padding_05">
                                            <ImageView
                                                android:id="@+id/SettingImgView"
                                                android:layout_height="wrap_content"
                                                android:src="@drawable/Settings"
                                                android:layout_width="18dp"
                                                android:layout_alignParentLeft="true"
                                                android:layout_centerVertical="true" />
                                            <TextView
                                                android:id="@+id/SettingsTxtView"
                                                android:text="Settings"
                                                android:layout_height="wrap_content"
                                                android:layout_width="wrap_content"
                                                android:textSize="@dimen/textSize_16"
                                                android:textColor="@color/colorWhite"
                                                android:layout_toRightOf="@+id/SettingImgView"
                                                android:layout_marginLeft="@dimen/margin_20"
                                                android:layout_centerVertical="true" />
                                        </RelativeLayout>
                                        <RelativeLayout
                                            android:id="@+id/setting1ItemLayout"
                                            android:layout_height="49dp"
                                            android:layout_below="@+id/setting2ItemLayout"
                                            android:layout_width="match_parent"
                                            android:layout_marginLeft="@dimen/margin_20"
                                            android:padding="@dimen/padding_05">
                                            <ImageView
                                                android:id="@+id/SettingImgView"
                                                android:layout_height="wrap_content"
                                                android:src="@drawable/Settings"
                                                android:layout_width="18dp"
                                                android:layout_alignParentLeft="true"
                                                android:layout_centerVertical="true" />
                                            <TextView
                                                android:id="@+id/SettingsTxtView"
                                                android:text="Settings"
                                                android:layout_height="wrap_content"
                                                android:layout_width="wrap_content"
                                                android:textSize="@dimen/textSize_16"
                                                android:textColor="@color/colorWhite"
                                                android:layout_toRightOf="@+id/SettingImgView"
                                                android:layout_marginLeft="@dimen/margin_20"
                                                android:layout_centerVertical="true" />
                                        </RelativeLayout>
                                        <RelativeLayout
                                            android:id="@+id/settingItemLayout"
                                           android:layout_below="@+id/setting1ItemLayout"
                                            android:layout_height="49dp"
                                            android:layout_width="match_parent"
                                            android:layout_marginLeft="@dimen/margin_20"
                                            android:padding="@dimen/padding_05">
                                            <ImageView
                                                android:id="@+id/SettingImgView"
                                                android:layout_height="wrap_content"
                                                android:src="@drawable/Settings"
                                                android:layout_width="18dp"
                                                android:layout_alignParentLeft="true"
                                                android:layout_centerVertical="true" />
                                            <TextView
                                                android:id="@+id/SettingsTxtView"
                                                android:text="Settings"
                                                android:layout_height="wrap_content"
                                                android:layout_width="wrap_content"
                                                android:textSize="@dimen/textSize_16"
                                                android:textColor="@color/colorWhite"
                                                android:layout_toRightOf="@+id/SettingImgView"
                                                android:layout_marginLeft="@dimen/margin_20"
                                                android:layout_centerVertical="true" />
                                        </RelativeLayout>
                                        <RelativeLayout
                                            android:id="@+id/FAQItemLayout"
                                            android:layout_below="@+id/settingItemLayout"
                                            android:layout_height="49dp"
                                            android:layout_width="match_parent"
                                            android:layout_marginLeft="@dimen/margin_20"
                                            android:padding="@dimen/padding_05">
                                            <ImageView
                                                android:id="@+id/FAQImgView"
                                                android:layout_height="wrap_content"
                                                android:src="@drawable/faq"
                                                android:layout_width="18dp"
                                                android:layout_alignParentLeft="true"
                                                android:layout_centerVertical="true" />
                                            <TextView
                                                android:id="@+id/FAQTxtView"
                                                android:text="FAQs"
                                                android:layout_height="wrap_content"
                                                android:layout_width="wrap_content"
                                                android:textSize="@dimen/textSize_16"
                                                android:textColor="@color/colorWhite"
                                                android:layout_toRightOf="@+id/FAQImgView"
                                                android:layout_marginLeft="@dimen/margin_20"
                                                android:layout_centerVertical="true" />
                                        </RelativeLayout>
                                        <RelativeLayout
                                            android:id="@+id/LogoutItemLayout"
                                            android:layout_below="@+id/FAQItemLayout"
                                            android:layout_height="49dp"
                                            android:layout_width="match_parent"
                                            android:layout_marginLeft="@dimen/margin_20"
                                            android:padding="@dimen/padding_05">
                                            <ImageView
                                                android:id="@+id/LogoutImgView"
                                                android:layout_height="wrap_content"
                                                android:src="@drawable/Logout"
                                                android:layout_width="18dp"
                                                android:layout_alignParentLeft="true"
                                                android:layout_centerVertical="true" />
                                            <TextView
                                                android:id="@+id/LogoutTxtView"
                                                android:text="Logout"
                                                android:layout_height="wrap_content"
                                                android:layout_width="wrap_content"
                                                android:textSize="@dimen/textSize_16"
                                                android:textColor="@color/colorWhite"
                                                android:layout_toRightOf="@+id/LogoutImgView"
                                                android:layout_marginLeft="@dimen/margin_20"
                                                android:layout_centerVertical="true" />
                                        </RelativeLayout>
                                        <ImageView
                                                android:id="@+id/betaLogo"
                                                android:layout_width="wrap_content"
                                                android:layout_height="wrap_content"
                                                android:src="@drawable/ratiomenulogo"
                                                android:layout_centerHorizontal="true"
                                                android:layout_below="@+id/LogoutItemLayout"
                                                android:layout_marginBottom="10dp"
                                                android:layout_marginTop="10dp"
                                                 />
                                        <TextView
                                                android:id="@+id/versionTxtView"
                                                android:text="Version 1.1.20"
                                                android:layout_height="wrap_content"
                                                app:fontFamily="@font/lato_regular"
                                                android:layout_width="wrap_content"
                                                android:textSize="@dimen/textSize_12"
                                                android:textColor="#1DD5A5"
                                                android:layout_toRightOf="@+id/LogoutImgView"
                                                android:layout_marginBottom="20dp"
                                                android:layout_below="@id/betaLogo"
                                                android:layout_marginLeft="@dimen/margin_20"

                                                android:layout_centerHorizontal="true" />
                                    </RelativeLayout>
                            </LinearLayout>


                        </RelativeLayout>

         </android.support.design.widget.NavigationView>
    </LinearLayout>
</ScrollView>


    //HomeView.cs
     public class HomeView : MvxAppCompatActivity<BaseViewModel>
    {

        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);


                SetContentView(Resource.Layout.HomeView);

                if (savedInstanceState == null)
                {

                    MenuFragment menuFragment = new MenuFragment();
                    var fragmenttransaction = this.SupportFragmentManager.BeginTransaction();
                    fragmenttransaction.Replace(Resource.Id.navigation_frame, menuFragment, "MenuFragment");
                    fragmenttransaction.AddToBackStack("MenuFragment");
                    fragmenttransaction.Commit();

                    NavigateToFragment<ProposalListFragment>("ProposalListFragment", true);
                }
       }
}

0 个答案:

没有答案