Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 如何添加滚动视图而不更改其他元素的可视化?_Android_Scrollview - Fatal编程技术网

Android 如何添加滚动视图而不更改其他元素的可视化?

Android 如何添加滚动视图而不更改其他元素的可视化?,android,scrollview,Android,Scrollview,目前,我每行有2张图片(通过毕加索加载),每个图片的右上角都有一个复选框。当我尝试添加Scrollview时,复选框的位置会改变,并且会出现一个额外的行。我如何添加它并保持其余可视化的正确顺序?以下是我到目前为止的代码(一行): 将UI元素的属性设置为父UI元素的右侧和左侧 android:layout_below="@id/name" android:layout_toRightOf="@id/description" android:layout_toLeftOf="@id/descript

目前,我每行有2张图片(通过毕加索加载),每个图片的右上角都有一个复选框。当我尝试添加Scrollview时,复选框的位置会改变,并且会出现一个额外的行。我如何添加它并保持其余可视化的正确顺序?以下是我到目前为止的代码(一行):


将UI元素的属性设置为父UI元素的右侧和左侧

android:layout_below="@id/name"
android:layout_toRightOf="@id/description"
android:layout_toLeftOf="@id/description" 
编辑: 我给你们做了一个示例代码:这不是确切的,你们可以从中吸取教训

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="0dip"
    android:id="@+id/parentLayout"
    android:layout_weight="1"
    android:orientation="horizontal"
    android:layout_marginTop="10dp">

<RelativeLayout
    android:layout_width="0dp"
    android:layout_toRightOf="@+id/parentLayout"
    android:layout_height="wrap_content"
    android:layout_weight="1">

    <ImageView
        android:id="@+id/img1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginRight="10dp" />

    <CheckBox
        android:id="@+id/checkBox1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"
        android:text=""
        android:background="@android:color/white"/>
</RelativeLayout>


检查此链接:

应相应地定位哪些UI元素?谢谢我仍然得到相同的可视化结果,不幸的是,逐个使用布局属性并对其进行调试。@user6456773请对我的答案进行投票并将其选择为接受答案
<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="0dip"
    android:id="@+id/parentLayout"
    android:layout_weight="1"
    android:orientation="horizontal"
    android:layout_marginTop="10dp">

<RelativeLayout
    android:layout_width="0dp"
    android:layout_toRightOf="@+id/parentLayout"
    android:layout_height="wrap_content"
    android:layout_weight="1">

    <ImageView
        android:id="@+id/img1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginRight="10dp" />

    <CheckBox
        android:id="@+id/checkBox1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"
        android:text=""
        android:background="@android:color/white"/>
</RelativeLayout>