Android 添加可绘制小部件后,mainactivity中的列表视图不可滚动
这里是MainActivity.xml 查看列表视图。。在添加抽屉小部件之前,这是可滚动的,但现在它不工作了。我做错了什么,请帮忙“ 这里是MainActivity.xml 查看列表视图。在添加抽屉小部件之前,这是可滚动的,但现在它不工作。我在这里做错了什么。请帮助“ 这里是MainActivity.xml 查看列表视图。。在添加抽屉小部件之前,这是可滚动的,但现在它不工作了。我做错了什么,请帮忙“ 这里是MainActivity.xml 查看列表视图。在添加抽屉小部件之前,这是可滚动的,但现在它不工作。我在这里做错了什么。请帮助“ 这里是MainActivity.xml 查看列表视图。。在添加抽屉小部件之前,这是可滚动的,但现在它不工作了。我做错了什么,请帮忙“Android 添加可绘制小部件后,mainactivity中的列表视图不可滚动,android,listview,Android,Listview,这里是MainActivity.xml 查看列表视图。。在添加抽屉小部件之前,这是可滚动的,但现在它不工作了。我做错了什么,请帮忙“ 这里是MainActivity.xml 查看列表视图。在添加抽屉小部件之前,这是可滚动的,但现在它不工作。我在这里做错了什么。请帮助“ 这里是MainActivity.xml 查看列表视图。。在添加抽屉小部件之前,这是可滚动的,但现在它不工作了。我做错了什么,请帮忙“ 这里是MainActivity.xml 查看列表视图。在添加抽屉小部件之前,这是可滚动的,但现在
将您的列表视图放入抽屉布局中。 像这样:
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<Button android:id="@+id/btn_fullscreen_ad"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"/>
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawerLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- The main content view -->
<RelativeLayout
android:id="@+id/mainContent"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<ListView
android:id="@+id/recipe_list_view"
android:layout_height="match_parent"
android:layout_width="match_parent">
</ListView>
<!-- The navigation drawer -->
<RelativeLayout
android:layout_width="280dp"
android:layout_height="match_parent"
android:id="@+id/drawerPane"
android:layout_gravity="start">
<!-- Profile Box -->
<RelativeLayout
android:id="@+id/profileBox"
android:layout_width="match_parent"
android:layout_height="100dp"
android:background="@color/material_blue_grey_800"
android:padding="8dp" >
<ImageView
android:id="@+id/avatar"
android:layout_width="50dp"
android:layout_height="50dp"
android:src="@color/material_blue_grey_800"
android:layout_marginTop="15dp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="42dp"
android:layout_centerVertical="true"
android:layout_marginLeft="15dp"
android:layout_toRightOf="@+id/avatar"
android:orientation="vertical" >
<TextView
android:id="@+id/userName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Rishabh"
android:textColor="#fff"
android:textSize="16sp"
android:textStyle="bold" />
<TextView
android:id="@+id/desc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginTop="4dp"
android:text="View Profile"
android:textColor="#fff"
android:textSize="12sp" />
</LinearLayout>
</RelativeLayout>
<!-- List of Actions (pages) -->
<ListView
android:id="@+id/navList"
android:layout_width="280dp"
android:layout_height="match_parent"
android:layout_below="@+id/profileBox"
android:choiceMode="singleChoice"
android:background="#ffffffff" />
</RelativeLayout>
</android.support.v4.widget.DrawerLayout>
</RelativeLayout>
这对我来说很有用。你的xml在哪里更新了xml这是我的主列表视图--在这里我列出了项目,并为侧边栏添加了android.support.v4.widget.DrawerLayout>。在此之后,我的主列表视图滚动不起作用。有人知道为什么会发生这种情况吗?
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<Button android:id="@+id/btn_fullscreen_ad"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"/>
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawerLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- The main content view -->
<RelativeLayout
android:id="@+id/mainContent"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<ListView
android:id="@+id/recipe_list_view"
android:layout_height="match_parent"
android:layout_width="match_parent">
</ListView>
<!-- The navigation drawer -->
<RelativeLayout
android:layout_width="280dp"
android:layout_height="match_parent"
android:id="@+id/drawerPane"
android:layout_gravity="start">
<!-- Profile Box -->
<RelativeLayout
android:id="@+id/profileBox"
android:layout_width="match_parent"
android:layout_height="100dp"
android:background="@color/material_blue_grey_800"
android:padding="8dp" >
<ImageView
android:id="@+id/avatar"
android:layout_width="50dp"
android:layout_height="50dp"
android:src="@color/material_blue_grey_800"
android:layout_marginTop="15dp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="42dp"
android:layout_centerVertical="true"
android:layout_marginLeft="15dp"
android:layout_toRightOf="@+id/avatar"
android:orientation="vertical" >
<TextView
android:id="@+id/userName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Rishabh"
android:textColor="#fff"
android:textSize="16sp"
android:textStyle="bold" />
<TextView
android:id="@+id/desc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginTop="4dp"
android:text="View Profile"
android:textColor="#fff"
android:textSize="12sp" />
</LinearLayout>
</RelativeLayout>
<!-- List of Actions (pages) -->
<ListView
android:id="@+id/navList"
android:layout_width="280dp"
android:layout_height="match_parent"
android:layout_below="@+id/profileBox"
android:choiceMode="singleChoice"
android:background="#ffffffff" />
</RelativeLayout>
</android.support.v4.widget.DrawerLayout>
</RelativeLayout>