android - ScrollView 在抽屉布局中不起作用。我已经在导航视图中放置了滚动条。但它不起作用
问题描述
ScrollView 在抽屉布局中不起作用。我已将滚动条放入导航视图中。但它不起作用。在下面的代码中 HomeView.cs 是显示抽屉布局的视图。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);
}
}
}
解决方案
推荐阅读
- python - 如何解决此错误“该进程无法访问该文件,因为它正在被另一个进程使用”?
- api - Soundcloud 获取直接音频 URL?
- reactjs - localstorage中的令牌交换从react js中的其他用户那里获取数据
- python - 网络抓取的数据有时只有效
- ms-word - 您可以将嵌套的重复内容控件与填充 Microsoft Word 模板操作一起使用吗?
- sql - 显示包含基于其他表中的值的动态值的列
- javascript - 如何获取用户信息,然后将它们保存到对象中?
- pytorch - RuntimeError:CUDA 错误:触发了设备端断言 - BART 模型
- database-design - 无头 CMS 是否适合交互式学习应用程序?
- c++ - 在这种情况下,我应该明确告诉编译器移动字符串吗?