繁体   English   中英

android 如何为我的以下代码提供滚动视图

[英]android how to give scrollview for my below code

自定义对话框

只需查看附加的快照,我希望中间部分应该滚动(欢迎和“解雇让我进入”按钮下方的那个除外)我为中间部分提供了 srollview,但它不起作用。 下面是我在 xml 中的代码。

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="fill_parent"
    android:layout_height="fill_parent">

    <RelativeLayout android:orientation="vertical" android:layout_width="fill_parent"
    android:layout_height="wrap_content">
    <LinearLayout android:id="@+id/layout"
            android:orientation="vertical" android:layout_width="fill_parent"
            android:layout_height="wrap_content" >
    <TextView android:text="Welcome" android:id="@+id/txtNew"
        android:layout_width="fill_parent" android:layout_height="wrap_content"
        android:textSize="20px" android:textStyle="bold" android:typeface="serif"
        android:gravity="center"
        android:paddingBottom="10dp"
        android:paddingTop="10dp" />
    <ImageView android:src="@drawable/devider"
        android:layout_width="wrap_content" android:layout_height="wrap_content"
        android:layout_gravity="center" android:paddingBottom="10dp"
        />
        </LinearLayout>
    </RelativeLayout>

    <RelativeLayout android:orientation="vertical" android:layout_width="fill_parent"
    android:layout_height="wrap_content">
    <ScrollView android:id="@+id/ScrollView01"
        android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingTop="50dp">
        <LinearLayout android:id="@+id/ayout"
            android:orientation="vertical" android:layout_width="fill_parent"
            android:layout_height="wrap_content" android:paddingTop="5dp">
            <TableLayout android:id="@+id/TableLayout01"
                android:layout_width="wrap_content" android:layout_height="wrap_content"
                android:paddingLeft="10dp">
                <TextView android:text="What's new?" android:id="@+id/txtNew"
                    android:layout_width="wrap_content" android:layout_height="wrap_content"
                    android:textSize="20px" android:textStyle="bold"
                    android:layout_gravity="center" android:paddingBottom="10dp"
                    android:paddingTop="10dp" />
                <TableRow>
                    <ImageView android:src="@drawable/star"
                        android:layout_width="wrap_content" android:layout_height="wrap_content" />
                    <TextView android:text="Cool and fun way of doodling with near and dear ones"
                        android:id="@+id/txt" android:layout_width="wrap_content"
                        android:layout_height="wrap_content" android:textSize="18px"
                        android:typeface="serif" />
                </TableRow>
                <TableRow>
                    <ImageView android:src="@drawable/star"
                        android:layout_width="wrap_content" android:layout_height="wrap_content" />
                    <TextView android:text="Using bluetooth for realtime transmission"
                        android:id="@+id/txt1" android:layout_width="wrap_content"
                        android:layout_height="wrap_content" android:textSize="18px"
                        android:typeface="serif" />
                </TableRow>
                <TableRow>
                    <ImageView android:src="@drawable/star"
                        android:layout_width="wrap_content" android:layout_height="wrap_content" />
                    <TextView android:text="U can share it with ur friends"
                        android:id="@+id/txt2" android:layout_width="wrap_content"
                        android:layout_height="wrap_content" android:textSize="18px"
                        android:typeface="serif" />
                </TableRow>

                <TextView android:text="Comming Soon" android:id="@+id/txtSoon"
                    android:layout_width="wrap_content" android:layout_height="wrap_content"
                    android:textSize="20px" android:textStyle="bold"
                    android:layout_gravity="center" android:paddingBottom="10dp"
                    android:paddingTop="10dp" />

                <TableRow>
                    <ImageView android:src="@drawable/star"
                        android:layout_width="wrap_content" android:layout_height="wrap_content" />
                    <TextView android:text="Save your Doodles" android:id="@+id/save"
                        android:layout_width="wrap_content" android:layout_height="wrap_content"
                        android:textSize="18px" android:typeface="serif" />
                </TableRow>
                <TableRow>
                    <ImageView android:src="@drawable/star"
                        android:layout_width="wrap_content" android:layout_height="wrap_content" />
                    <TextView android:text="Choosing Colors" android:id="@+id/colors"
                        android:layout_width="wrap_content" android:layout_height="wrap_content"
                        android:textSize="18px" android:typeface="sans" />
                </TableRow>

                <TableRow>
                    <ImageView android:src="@drawable/star"
                        android:layout_width="wrap_content" android:layout_height="wrap_content" />
                    <TextView android:text="Eraser" android:id="@+id/eraser"
                        android:layout_width="wrap_content" android:layout_height="wrap_content"
                        android:textSize="18px" android:typeface="normal" />
                </TableRow>

                <TableRow>
                    <ImageView android:src="@drawable/star"
                        android:layout_width="wrap_content" android:layout_height="wrap_content" />
                    <TextView android:text="Shapes" android:id="@+id/shapes"
                        android:layout_width="wrap_content" android:layout_height="wrap_content"
                        android:textSize="18px" android:typeface="monospace" />
                </TableRow>

                <TableRow>
                    <ImageView android:src="@drawable/star"
                        android:layout_width="wrap_content" android:layout_height="wrap_content" />
                    <TextView android:text="Brush Size" android:id="@+id/brush"
                        android:layout_width="wrap_content" android:layout_height="wrap_content"
                        android:textSize="18px" android:typeface="serif" />
                </TableRow>

                <TableRow>
                    <ImageView android:src="@drawable/star"
                        android:layout_width="wrap_content" android:layout_height="wrap_content" />
                    <TextView android:text="Brush Size" android:id="@+id/brush1"
                        android:layout_width="wrap_content" android:layout_height="wrap_content"
                        android:textSize="18px" android:typeface="serif" />
                </TableRow>

            </TableLayout>
        </LinearLayout>
    </ScrollView>
    </RelativeLayout>

    <RelativeLayout android:id="@+id/parent"
        android:layout_width="fill_parent" android:layout_height="wrap_content">
        <LinearLayout android:id="@+id/myLayout"
            android:orientation="vertical" android:layout_width="fill_parent"
            android:layout_height="wrap_content" android:paddingTop="5dp"
            android:layout_alignParentBottom="true" android:background="#FF999999">
            <Button android:id="@+id/alignButtom" android:layout_width="wrap_content"
                android:paddingTop="10dp" android:layout_height="wrap_content"
                android:text="Dismiss let me in" android:layout_gravity="center" />
        </LinearLayout>
    </RelativeLayout>

</RelativeLayout>

为什么滚动视图不起作用我不知道,请任何人解决它。 谢谢

添加:

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_width="fill_parent" android:layout_height="fill_parent">
            <RelativeLayout android:orientation="vertical"
                android:layout_width="fill_parent" android:layout_height="wrap_content">
                ....
             </RelativeLayout>
        </ScrollView>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

     <LinearLayout android:id="@+id/layout"
            android:orientation="vertical" 
            android:layout_width="fill_parent"
            android:layout_height="wrap_content" >
        <TextView android:text="Welcome" android:id="@+id/txtNew"
            android:layout_width="fill_parent" android:layout_height="wrap_content"
            android:textSize="20px" android:textStyle="bold" android:typeface="serif"
            android:gravity="center"
            android:paddingBottom="10dp"
            android:paddingTop="10dp" />
        <ImageView android:src="@drawable/devider"
            android:layout_width="wrap_content" android:layout_height="wrap_content"
            android:layout_gravity="center" android:paddingBottom="10dp"/>
        </LinearLayout>
    <ScrollView 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent"
      android:scrollbarFadeDuration="2000"
      android:fadeScrollbars="true"
      android:orientation="vertical"
      android:layout_marginBottom="50dip">
     <LinearLayout android:id="@+id/ayout"
            android:orientation="vertical" android:layout_width="fill_parent"
            android:layout_height="wrap_content" android:paddingTop="5dp">
            <TableLayout android:id="@+id/TableLayout01"
                android:layout_width="wrap_content" android:layout_height="wrap_content"
                android:paddingLeft="10dp">
                <TextView android:text="What's new?" android:id="@+id/txtNew"
                    android:layout_width="wrap_content" android:layout_height="wrap_content"
                    android:textSize="20px" android:textStyle="bold"
                    android:layout_gravity="center" android:paddingBottom="10dp"
                    android:paddingTop="10dp" />
                <TableRow>
                    <ImageView android:src="@drawable/star"
                        android:layout_width="wrap_content" android:layout_height="wrap_content" />
                    <TextView android:text="Cool and fun way of doodling with near and dear ones"
                        android:id="@+id/txt" android:layout_width="wrap_content"
                        android:layout_height="wrap_content" android:textSize="18px"
                        android:typeface="serif" />
                </TableRow>
                <TableRow>
                    <ImageView android:src="@drawable/star"
                        android:layout_width="wrap_content" android:layout_height="wrap_content" />
                    <TextView android:text="Using bluetooth for realtime transmission"
                        android:id="@+id/txt1" android:layout_width="wrap_content"
                        android:layout_height="wrap_content" android:textSize="18px"
                        android:typeface="serif" />
                </TableRow>
                <TableRow>
                    <ImageView android:src="@drawable/star"
                        android:layout_width="wrap_content" android:layout_height="wrap_content" />
                    <TextView android:text="U can share it with ur friends"
                        android:id="@+id/txt2" android:layout_width="wrap_content"
                        android:layout_height="wrap_content" android:textSize="18px"
                        android:typeface="serif" />
                </TableRow>

                <TextView android:text="Comming Soon" android:id="@+id/txtSoon"
                    android:layout_width="wrap_content" android:layout_height="wrap_content"
                    android:textSize="20px" android:textStyle="bold"
                    android:layout_gravity="center" android:paddingBottom="10dp"
                    android:paddingTop="10dp" />

                <TableRow>
                    <ImageView android:src="@drawable/star"
                        android:layout_width="wrap_content" android:layout_height="wrap_content" />
                    <TextView android:text="Save your Doodles" android:id="@+id/save"
                        android:layout_width="wrap_content" android:layout_height="wrap_content"
                        android:textSize="18px" android:typeface="serif" />
                </TableRow>
                <TableRow>
                    <ImageView android:src="@drawable/star"
                        android:layout_width="wrap_content" android:layout_height="wrap_content" />
                    <TextView android:text="Choosing Colors" android:id="@+id/colors"
                        android:layout_width="wrap_content" android:layout_height="wrap_content"
                        android:textSize="18px" android:typeface="sans" />
                </TableRow>

                <TableRow>
                    <ImageView android:src="@drawable/star"
                        android:layout_width="wrap_content" android:layout_height="wrap_content" />
                    <TextView android:text="Eraser" android:id="@+id/eraser"
                        android:layout_width="wrap_content" android:layout_height="wrap_content"
                        android:textSize="18px" android:typeface="normal" />
                </TableRow>

                <TableRow>
                    <ImageView android:src="@drawable/star"
                        android:layout_width="wrap_content" android:layout_height="wrap_content" />
                    <TextView android:text="Shapes" android:id="@+id/shapes"
                        android:layout_width="wrap_content" android:layout_height="wrap_content"
                        android:textSize="18px" android:typeface="monospace" />
                </TableRow>

                <TableRow>
                    <ImageView android:src="@drawable/star"
                        android:layout_width="wrap_content" android:layout_height="wrap_content" />
                    <TextView android:text="Brush Size" android:id="@+id/brush"
                        android:layout_width="wrap_content" android:layout_height="wrap_content"
                        android:textSize="18px" android:typeface="serif" />
                </TableRow>

                <TableRow>
                    <ImageView android:src="@drawable/star"
                        android:layout_width="wrap_content" android:layout_height="wrap_content" />
                    <TextView android:text="Brush Size" android:id="@+id/brush1"
                        android:layout_width="wrap_content" android:layout_height="wrap_content"
                        android:textSize="18px" android:typeface="serif" />
                </TableRow>

            </TableLayout>
        </LinearLayout>
    </ScrollView>
    <LinearLayout android:layout_width="fill_parent" 
    android:layout_height="wrap_content"
    android:gravity="center_horizontal"
    android:layout_marginTop="-50dip">
     <Button android:id="@+id/alignButtom" android:layout_width="wrap_content"
        android:paddingTop="10dp" android:layout_height="wrap_content"
        android:text="Dismiss let me in" android:layout_gravity="center" />
    </LinearLayout>
</LinearLayout> 

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM