最终以一个ClassCastException崩溃

最终以一个ClassCastException崩溃

本文介绍了添加一个线性布局,导航抽屉(最终以一个ClassCastException崩溃)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我想添加一个垂直线性布局(带有标题,图像,菜单标题,ListView和底部的图标)来导航的抽屉里。然而,应用程序崩溃显示

 java.lang.ClassCastException:android.widget.LinearLayout $的LayoutParams不能转换为android.support.v4.widget.DrawerLayout $的LayoutParams
 

错误。我不知道这是因为我查了几个环节,我得到的是this.任何帮助是AP preciated。提前致谢。这是我的code。    

 <! - 主要背景视图 - >

<的FrameLayout
    机器人:ID =@ + ID / content_frame
    机器人:layout_width =match_parent
    机器人:layout_height =match_parent/>

<! - 导航抽屉 - >

<的LinearLayout
    机器人:layout_width =240dp
    机器人:layout_height =match_parent
    机器人:layout_gravity =开始
    机器人:后台=#FFF
    机器人:重力=底部|中心
    机器人:方向=垂直
    机器人:paddingTop =30dp>

    <的ListView
        机器人:ID =@ + ID / left_drawer
        机器人:choiceMode =singleChoice
        机器人:分隔=#E8E8E8
        机器人:dividerHeight =1DP
        机器人:footerDividersEnabled =假
        机器人:headerDividersEnabled =FALSE/>

    < ImageView的
        机器人:layout_width =WRAP_CONTENT
        机器人:layout_height =WRAP_CONTENT
        机器人:layout_gravity =中心
        机器人:填充=10dp
        机器人:SRC =@可绘制/ footer_image/>
< / LinearLayout中>
 

现在这里的问题是,XML不是让我来定义的宽度和高度列表视图(元素是未知的),我也不能运行它的编译器说,你必须提供一个layout_width属性?请大家帮帮忙。

我的code与滚动视图。

 < android.support.v4.widget.DrawerLayout的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
机器人:ID =@ + ID / drawer_layout
机器人:layout_width =match_parent
机器人:layout_height =match_parent>

<! - 主要背景视图 - >

<的FrameLayout
    机器人:ID =@ + ID / content_frame
    机器人:layout_width =match_parent
    机器人:layout_height =match_parent/>

<! - 导航抽屉 - >

<滚动型
    机器人:ID =@ + ID / leftRL
    机器人:layout_width =240dp
    机器人:layout_height =match_parent
    机器人:layout_gravity =开始
    机器人:layout_marginBottom =5DP
    机器人:后台=#FFF>

    <的LinearLayout
        机器人:layout_width =match_parent
        机器人:layout_height =WRAP_CONTENT
        机器人:方向=垂直>

        <的LinearLayout
            机器人:layout_width =match_parent
            机器人:layout_height =WRAP_CONTENT
            机器人:方向=垂直
            机器人:以下属性来=10dp
            机器人:paddingRight =10dp
            机器人:paddingTop =10dp>

            <的TextView
                机器人:layout_width =WRAP_CONTENT
                机器人:layout_height =WRAP_CONTENT
                机器人:paddingBottom会=3DP
                机器人:SRC =@可绘制/ ic_launcher
                机器人:文本=假
                机器人:文字颜色=#2E3192
                机器人:TEXTSTYLE =黑体/>

            <查看
                机器人:layout_width =FILL_PARENT
                机器人:layout_height =2DIP
                机器人:后台=#2E3192/>

            <的LinearLayout
                机器人:layout_width =match_parent
                机器人:layout_height =WRAP_CONTENT
                机器人:方向=横向
                机器人:paddingTop =2DP>

                < ImageView的
                    机器人:layout_width =0dp
                    机器人:layout_height =match_parent
                    机器人:layout_weight =3
                    机器人:后台=#e8e8e8
                    机器人:scaleType =fitXY
                    机器人:SRC =@可绘制/ ic_launcher/>

                <的LinearLayout
                    机器人:layout_width =0dp
                    机器人:layout_height =match_parent
                    机器人:layout_weight =7
                    机器人:重力=中心
                    机器人:方向=垂直
                    机器人:填充=5DP>

                    <的TextView
                        机器人:layout_width =match_parent
                        机器人:layout_height =WRAP_CONTENT
                        机器人:文本=虚拟名称
                        机器人:TEXTSIZE =15sp/>

                    <的TextView
                        机器人:layout_width =match_parent
                        机器人:layout_height =WRAP_CONTENT
                        机器人:文本[email protected]
                        机器人:TEXTSIZE =10SP/>
                < / LinearLayout中>
            < / LinearLayout中>

            <的TextView
                机器人:layout_width =WRAP_CONTENT
                机器人:layout_height =WRAP_CONTENT
                机器人:layout_marginTop =20dp
                机器人:paddingBottom会=3DP
                机器人:SRC =@可绘制/ ic_launcher
                机器人:文本=虚拟商品
                机器人:文字颜色=#2E3192
                机器人:TEXTSTYLE =黑体/>

            <查看
                机器人:layout_width =FILL_PARENT
                机器人:layout_height =2DIP
                机器人:后台=#2E3192/>
        < / LinearLayout中>

        < ListView控件/>

        < ImageView的
            机器人:layout_width =WRAP_CONTENT
            机器人:layout_height =WRAP_CONTENT
            机器人:layout_gravity =中心
            机器人:layout_marginTop =40dp
            机器人:填充=10dp
            机器人:SRC =@可绘制/ footer_image/>
    < / LinearLayout中>
< /滚动型>

< /android.support.v4.widget.DrawerLayout>
 

解决方案

我用你的答案,谢谢:)解决方案。其实这个问题是与列表视图。我是越来越左边抽屉的线性布局,但我添加了一个滚动视图我的线性布局,我也有一个列表,其中显示在列表中只有第一项相同的观点而使整个屏幕空间,它不是正常显示空白。我检查几个环节才能得到答案,但没有奏效。最后,由于该表的数据是众所周知的我,它不会动态改变我加单选按钮,自定义它们,取而代之的清单。

我的code类似于下吧。

 < android.support.v4.widget.DrawerLayout的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
机器人:ID =@ + ID / drawer_layout
机器人:layout_width =match_parent
机器人:layout_height =match_parent
机器人:背景=@色/ app_background>

<! - 主要背景视图 - >

<的FrameLayout
    机器人:ID =@ + ID / fragment_holder
    机器人:layout_width =match_parent
    机器人:layout_height =match_parent/>

<! - 导航抽屉 - >

<滚动型
    机器人:ID =@ + ID / leftDrawer
    机器人:layout_width =240dp
    机器人:layout_height =match_parent
    机器人:layout_gravity =开始
    机器人:后台=#FFF>

    <的LinearLayout
        机器人:layout_width =match_parent
        机器人:layout_height =WRAP_CONTENT
        机器人:方向=垂直>

        <的TextView
            机器人:layout_width =WRAP_CONTENT
            机器人:layout_height =WRAP_CONTENT
            机器人:layout_marginLeft =10dp
            机器人:layout_marginRight =10dp
            机器人:layout_marginTop =10dp
            机器人:paddingBottom会=3DP
            机器人:SRC =@可绘制/ ic_launcher
            机器人:文本=@字符串/ menu_account
            机器人:文字颜色=@色/ nav_headingsColor
            机器人:TEXTSTYLE =黑体/>

        <查看
            机器人:layout_width =FILL_PARENT
            机器人:layout_height =2DIP
            机器人:layout_marginLeft =10dp
            机器人:layout_marginRight =10dp
            机器人:背景=@色/ nav_headingsColor/>

        <的LinearLayout
            机器人:layout_width =match_parent
            机器人:layout_height =WRAP_CONTENT
            机器人:layout_marginLeft =10dp
            机器人:layout_marginRight =10dp
            机器人:方向=横向>

            < ImageView的
                机器人:ID =@ + ID / imgProfilePic
                机器人:layout_width =0dp
                机器人:layout_height =70dp
                机器人:layout_weight =3
                机器人:scaleType =fitXY
                机器人:SRC =@可绘制/ ic_launcher/>

            <的LinearLayout
                机器人:layout_width =match_parent
                机器人:layout_height =WRAP_CONTENT
                机器人:方向=横向>

                < ImageView的
                    机器人:ID =@ + ID / imgProfilePic
                    机器人:layout_width =0dp
                    机器人:layout_height =70dp
                    机器人:layout_weight =3
                    机器人:可点击=真
                    机器人:contentDescription =@空
                    机器人:scaleType =fitXY
                    机器人:SRC =@可绘制/ ic_launcher/>

                <的LinearLayout
                    机器人:layout_width =0dp
                    机器人:layout_height =match_parent
                    机器人:layout_weight =7
                    机器人:重力=中心
                    机器人:方向=垂直
                    机器人:填充=5DP>

                    <的TextView
                        机器人:ID =@ + ID / lblName
                        机器人:layout_width =match_parent
                        机器人:layout_height =WRAP_CONTENT
                        机器人:文本=克里斯蒂安·贝尔
                        机器人:文字颜色=@色/ nav_textColor
                        机器人:TEXTSIZE =18sp/>

                    <的TextView
                        机器人:ID =@ + ID / lblEmail
                        机器人:layout_width =match_parent
                        机器人:layout_height =WRAP_CONTENT
                        机器人:文本[email protected]
                        机器人:文字颜色=@色/ nav_textColor
                        机器人:TEXTSIZE =10SP/>
                < / LinearLayout中>
            < / LinearLayout中>
        < / LinearLayout中>

        <的TextView
            机器人:layout_width =WRAP_CONTENT
            机器人:layout_height =WRAP_CONTENT
            机器人:layout_marginLeft =10dp
            机器人:layout_marginRight =10dp
            机器人:layout_marginTop =20dp
            机器人:paddingBottom会=3DP
            机器人:SRC =@可绘制/ ic_launcher
            机器人:文本=@字符串/ menu_menu
            机器人:文字颜色=@色/ nav_headingsColor
            机器人:TEXTSTYLE =黑体/>

        <查看
            机器人:layout_width =FILL_PARENT
            机器人:layout_height =2DIP
            机器人:layout_marginLeft =10dp
            机器人:layout_marginRight =10dp
            机器人:背景=@色/ nav_headingsColor/>

        < RadioGroup中
            机器人:ID =@ + ID / RadioGroup中
            机器人:layout_width =FILL_PARENT
            机器人:layout_height =WRAP_CONTENT
            机器人:layout_marginRight =5dip
            机器人:layout_marginTop =2DIP>

            <单选按钮
                机器人:ID =@ + ID / radioTopTen
                风格=@风格/单选按钮
                机器人:layout_width =match_parent
                机器人:layout_height =WRAP_CONTENT
                机器人:drawableLeft =@可绘制/ ic_launcher
                机器人:以下属性来=20dp
                机器人:文本=@字符串/ menu_topTen/>

            <查看
                机器人:layout_width =FILL_PARENT
                机器人:layout_height =1dip
                机器人:背景=@色/ nav_itemSep/>

            <单选按钮
                机器人:ID =@ + ID / radioWish
                风格=@风格/单选按钮
                机器人:layout_width =match_parent
                机器人:layout_height =WRAP_CONTENT
                机器人:drawableLeft =@可绘制/ ic_launcher
                机器人:以下属性来=20dp
                机器人:文本=@字符串/ menu_wish/>

            <查看
                机器人:layout_width =FILL_PARENT
                机器人:layout_height =1dip
                机器人:背景=@色/ nav_itemSep/>

            <单选按钮
                机器人:ID =@ + ID / radioGifts
                风格=@风格/单选按钮
                机器人:layout_width =match_parent
                机器人:layout_height =WRAP_CONTENT
                机器人:drawableLeft =@可绘制/ ic_launcher
                机器人:以下属性来=20dp
                机器人:文本=@字符串/ menu_gifts/>

            <查看
                机器人:layout_width =FILL_PARENT
                机器人:layout_height =1dip
                机器人:背景=@色/ nav_itemSep/>

            <单选按钮
                机器人:ID =@ + ID / radioLibrary
                风格=@风格/单选按钮
                机器人:layout_width =match_parent
                机器人:layout_height =WRAP_CONTENT
                机器人:drawableLeft =@可绘制/ ic_launcher
                机器人:以下属性来=20dp
                机器人:文本=@字符串/ menu_library/>

            <查看
                机器人:layout_width =FILL_PARENT
                机器人:layout_height =1dip
                机器人:背景=@色/ nav_itemSep/>

            <单选按钮
                机器人:ID =@ + ID / radioWhatsOn
                风格=@风格/单选按钮
                机器人:layout_width =match_parent
                机器人:layout_height =WRAP_CONTENT
                机器人:drawableLeft =@可绘制/ ic_launcher
                机器人:以下属性来=20dp
                机器人:文本=@字符串/ menu_whatsOn/>

            <查看
                机器人:layout_width =FILL_PARENT
                机器人:layout_height =1dip
                机器人:背景=@色/ nav_itemSep/>

            <单选按钮
                机器人:ID =@ + ID / radioDownload
                风格=@风格/单选按钮
                机器人:layout_width =match_parent
                机器人:layout_height =WRAP_CONTENT
                机器人:drawableLeft =@可绘制/ ic_launcher
                机器人:以下属性来=20dp
                机器人:文本=@字符串/ menu_download/>
        < / RadioGroup中>

        < ImageView的
            机器人:layout_width =WRAP_CONTENT
            机器人:layout_height =WRAP_CONTENT
            机器人:layout_gravity =中心
            机器人:layout_marginTop =40dp
            机器人:填充=10dp
            机器人:SRC =@可绘制/ footer_image/>
    < / LinearLayout中>
< /滚动型>
 

我知道这可能不是最好的可能性,但至少它为我工作。如果任何人有一个更好的解决方案,那么请让我知道。

I am trying to add a vertical linear layout (having a title, image, menu title, listview and an icon at the bottom)to the navigation drawer. However the app crashes displaying

'java.lang.ClassCastException: android.widget.LinearLayout$LayoutParams cannot be cast to android.support.v4.widget.DrawerLayout$LayoutParams'

error. I am not sure if this is possible straight ways as I checked couple of links and the only close I got was this. Any help is appreciated.Thanks in advance.Here is my code.

<!-- The main context view -->

<FrameLayout
    android:id="@+id/content_frame"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

<!-- The navigation drawer -->

<LinearLayout
    android:layout_width="240dp"
    android:layout_height="match_parent"
    android:layout_gravity="start"
    android:background="#fff"
    android:gravity="bottom|center"
    android:orientation="vertical"
    android:paddingTop="30dp" >

    <ListView
        android:id="@+id/left_drawer"
        android:choiceMode="singleChoice"
        android:divider="#E8E8E8"
        android:dividerHeight="1dp"
        android:footerDividersEnabled="false"
        android:headerDividersEnabled="false" />

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:padding="10dp"
        android:src="@drawable/footer_image" />
</LinearLayout>

Now the issue here is, xml is not allowing me to define width and height for the listview (Element is unknown) and I am also not able to run it as compiler says "You must supply a layout_width" attribute?? Please help.

My code with the scrollview.

<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent" >

<!-- The main context view -->

<FrameLayout
    android:id="@+id/content_frame"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

<!-- The navigation drawer -->

<ScrollView
    android:id="@+id/leftRL"
    android:layout_width="240dp"
    android:layout_height="match_parent"
    android:layout_gravity="start"
    android:layout_marginBottom="5dp"
    android:background="#fff" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical" >

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:paddingLeft="10dp"
            android:paddingRight="10dp"
            android:paddingTop="10dp" >

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:paddingBottom="3dp"
                android:src="@drawable/ic_launcher"
                android:text="Dummy"
                android:textColor="#2E3192"
                android:textStyle="bold" />

            <View
                android:layout_width="fill_parent"
                android:layout_height="2dip"
                android:background="#2E3192" />

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal"
                android:paddingTop="2dp" >

                <ImageView
                    android:layout_width="0dp"
                    android:layout_height="match_parent"
                    android:layout_weight="3"
                    android:background="#e8e8e8"
                    android:scaleType="fitXY"
                    android:src="@drawable/ic_launcher" />

                <LinearLayout
                    android:layout_width="0dp"
                    android:layout_height="match_parent"
                    android:layout_weight="7"
                    android:gravity="center"
                    android:orientation="vertical"
                    android:padding="5dp" >

                    <TextView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:text="Dummy name"
                        android:textSize="15sp" />

                    <TextView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:text="[email protected]"
                        android:textSize="10sp" />
                </LinearLayout>
            </LinearLayout>

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="20dp"
                android:paddingBottom="3dp"
                android:src="@drawable/ic_launcher"
                android:text="Dummy item"
                android:textColor="#2E3192"
                android:textStyle="bold" />

            <View
                android:layout_width="fill_parent"
                android:layout_height="2dip"
                android:background="#2E3192" />
        </LinearLayout>

        <ListView/>

        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_marginTop="40dp"
            android:padding="10dp"
            android:src="@drawable/footer_image" />
    </LinearLayout>
</ScrollView>

</android.support.v4.widget.DrawerLayout>
解决方案

I got the solution using your answers, thanks :). Actually the issue was with the list view. I was getting the linear layout on the left drawer, however it wasnt displayed properly as I added a scroll View to my linear layout and I also had a list in the same view which displayed only the first item in the list leaving the entire screen space blank. I checked few links to get the answer but it didn't work. At the end, since the list data is known to me and it will not change dynamically I added RadioButtons, customized them and replaced the list.

My code looks like below now.

<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/app_background" >

<!-- The main context view -->

<FrameLayout
    android:id="@+id/fragment_holder"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

<!-- The navigation drawer -->

<ScrollView
    android:id="@+id/leftDrawer"
    android:layout_width="240dp"
    android:layout_height="match_parent"
    android:layout_gravity="start"
    android:background="#fff" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical" >

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="10dp"
            android:layout_marginRight="10dp"
            android:layout_marginTop="10dp"
            android:paddingBottom="3dp"
            android:src="@drawable/ic_launcher"
            android:text="@string/menu_account"
            android:textColor="@color/nav_headingsColor"
            android:textStyle="bold" />

        <View
            android:layout_width="fill_parent"
            android:layout_height="2dip"
            android:layout_marginLeft="10dp"
            android:layout_marginRight="10dp"
            android:background="@color/nav_headingsColor" />

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="10dp"
            android:layout_marginRight="10dp"
            android:orientation="horizontal" >

            <ImageView
                android:id="@+id/imgProfilePic"
                android:layout_width="0dp"
                android:layout_height="70dp"
                android:layout_weight="3"
                android:scaleType="fitXY"
                android:src="@drawable/ic_launcher" />

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal" >

                <ImageView
                    android:id="@+id/imgProfilePic"
                    android:layout_width="0dp"
                    android:layout_height="70dp"
                    android:layout_weight="3"
                    android:clickable="true"
                    android:contentDescription="@null"
                    android:scaleType="fitXY"
                    android:src="@drawable/ic_launcher" />

                <LinearLayout
                    android:layout_width="0dp"
                    android:layout_height="match_parent"
                    android:layout_weight="7"
                    android:gravity="center"
                    android:orientation="vertical"
                    android:padding="5dp" >

                    <TextView
                        android:id="@+id/lblName"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:text="Christian Bale"
                        android:textColor="@color/nav_textColor"
                        android:textSize="18sp" />

                    <TextView
                        android:id="@+id/lblEmail"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:text="[email protected]"
                        android:textColor="@color/nav_textColor"
                        android:textSize="10sp" />
                </LinearLayout>
            </LinearLayout>
        </LinearLayout>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="10dp"
            android:layout_marginRight="10dp"
            android:layout_marginTop="20dp"
            android:paddingBottom="3dp"
            android:src="@drawable/ic_launcher"
            android:text="@string/menu_menu"
            android:textColor="@color/nav_headingsColor"
            android:textStyle="bold" />

        <View
            android:layout_width="fill_parent"
            android:layout_height="2dip"
            android:layout_marginLeft="10dp"
            android:layout_marginRight="10dp"
            android:background="@color/nav_headingsColor" />

        <RadioGroup
            android:id="@+id/radioGroup"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginRight="5dip"
            android:layout_marginTop="2dip" >

            <RadioButton
                android:id="@+id/radioTopTen"
                style="@style/RadioButton"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:drawableLeft="@drawable/ic_launcher"
                android:paddingLeft="20dp"
                android:text="@string/menu_topTen" />

            <View
                android:layout_width="fill_parent"
                android:layout_height="1dip"
                android:background="@color/nav_itemSep" />

            <RadioButton
                android:id="@+id/radioWish"
                style="@style/RadioButton"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:drawableLeft="@drawable/ic_launcher"
                android:paddingLeft="20dp"
                android:text="@string/menu_wish" />

            <View
                android:layout_width="fill_parent"
                android:layout_height="1dip"
                android:background="@color/nav_itemSep" />

            <RadioButton
                android:id="@+id/radioGifts"
                style="@style/RadioButton"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:drawableLeft="@drawable/ic_launcher"
                android:paddingLeft="20dp"
                android:text="@string/menu_gifts" />

            <View
                android:layout_width="fill_parent"
                android:layout_height="1dip"
                android:background="@color/nav_itemSep" />

            <RadioButton
                android:id="@+id/radioLibrary"
                style="@style/RadioButton"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:drawableLeft="@drawable/ic_launcher"
                android:paddingLeft="20dp"
                android:text="@string/menu_library" />

            <View
                android:layout_width="fill_parent"
                android:layout_height="1dip"
                android:background="@color/nav_itemSep" />

            <RadioButton
                android:id="@+id/radioWhatsOn"
                style="@style/RadioButton"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:drawableLeft="@drawable/ic_launcher"
                android:paddingLeft="20dp"
                android:text="@string/menu_whatsOn" />

            <View
                android:layout_width="fill_parent"
                android:layout_height="1dip"
                android:background="@color/nav_itemSep" />

            <RadioButton
                android:id="@+id/radioDownload"
                style="@style/RadioButton"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:drawableLeft="@drawable/ic_launcher"
                android:paddingLeft="20dp"
                android:text="@string/menu_download" />
        </RadioGroup>

        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_marginTop="40dp"
            android:padding="10dp"
            android:src="@drawable/footer_image" />
    </LinearLayout>
</ScrollView>

I know this might not be the best possibility but at least its working for me. If any one has a better solution, then please let me know.

这篇关于添加一个线性布局,导航抽屉(最终以一个ClassCastException崩溃)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 18:39