我无法获得最终的textview以显示水平滚动视图

时间:2016-03-04 21:50:36

标签: android android-layout

我正在尝试直接在水平滚动视图下和我的相对视图的左侧显示我的最终TextView。我究竟做错了什么?当我添加layout_below @+id/discussionHorScrollView时,它也无法正常工作。

  <HorizontalScrollView
        android:id="@+id/discussionHorScrollView"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/scrollViewQuestion"
        android:layout_marginTop="12dp"
        android:paddingTop="10dp"
        android:paddingBottom="10dp"
        android:scrollbarFadeDuration="0">
        <LinearLayout
            android:id="@+id/discussionScrollBar"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content" />
    </HorizontalScrollView>
  <RelativeLayout
        android:id="@+id/FullResponseAvatar"
        android:layout_width="70dp"
        android:layout_height="70dp"
        android:layout_below ="@id/discussionHorScrollView"
        android:layout_alignParentRight="true"
        android:layout_marginRight="5dp">
    <MvxImageView
        android:id="@+id/ResponseAavatar"
        android:layout_width="50dp"
        android:layout_height="50dp"
        android:layout_centerVertical="true"
        android:layout_centerHorizontal="true"
        local:MvxBind="ImageUrl QuickResponse.AvatarUrl; DefaultImagePath 'res:icon_user'" />
    <ImageView
        android:src="@drawable/discussion_image_frame"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
  </RelativeLayout>
  <TextView
        android:id="@+id/txtDiscussionTitle"
        android:textDirection="locale"
        android:textAlignment="viewStart"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textSize="16sp"
        android:layout_toLeftOf="@id/FullResponseAvatar"
        android:layout_toStartOf="@id/FullResponseAvatar"
        android:textColor="@color/discussion_cell_title_text"
        local:MvxBind="Text QuickResponse.FullName" />

编辑:我的完整视图(在我工作的地方添加了一些回复)

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:local="http://schemas.android.com/apk/res-auto"
    android:id="@+id/mainmenu"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="#fff">
    <RelativeLayout
        android:id="@+id/imgFullDiscussionAvatar"
        android:layout_width="70dp"
        android:layout_height="70dp"
        android:layout_marginTop="5dp"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true">
        <MvxImageView
            android:id="@+id/imgDiscussionAvatar"
            android:layout_width="50dp"
            android:layout_height="50dp"
            android:layout_centerVertical="true"
            android:layout_centerHorizontal="true"
            local:MvxBind="ImageUrl QuickResponse.Question.AvatarUrl; DefaultImagePath 'res:icon_user'" />
        <ImageView
            android:src="@drawable/discussion_image_frame"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />
    </RelativeLayout>
    <TextView
        android:id="@+id/txtDiscussionTitle"
        android:textDirection="locale"
        android:textAlignment="viewStart"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        android:textSize="16sp"
        android:layout_toRightOf="@id/imgFullDiscussionAvatar"
        android:layout_toEndOf="@id/imgFullDiscussionAvatar"
        android:textColor="@color/discussion_cell_title_text"
        local:MvxBind="Text ModFullName" />
    <ScrollView
        android:id="@+id/scrollViewQuestion"
        android:visibility="visible"
        android:layout_width="wrap_content"
        android:layout_height="90dp"
        android:layout_toRightOf="@id/imgFullDiscussionAvatar"
        android:layout_toEndOf="@id/imgFullDiscussionAvatar"
        android:layout_below="@id/txtDiscussionTitle">
        <TextView
            android:id="@+id/txtDiscussionText"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:textDirection="locale"
            android:textAlignment="viewStart"
            android:textSize="12sp"
            android:textColor="@color/discussion_cell_content_text"
            local:MvxBind="Text QuickResponse.Question.Body" />
    </ScrollView>
    <HorizontalScrollView
        android:id="@+id/discussionHorScrollView"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/scrollViewQuestion"
        android:layout_marginTop="12dp"
        android:paddingTop="10dp"
        android:paddingBottom="10dp"
        android:scrollbarFadeDuration="0">
        <LinearLayout
            android:id="@+id/discussionScrollBar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />
    </HorizontalScrollView>



  <RelativeLayout
        android:id="@+id/FullResponseAvatar"
        android:layout_width="70dp"
        android:layout_height="70dp"
        android:layout_below ="@id/discussionHorScrollView"
        android:layout_alignParentRight="true"
        android:layout_marginRight="5dp">
    <MvxImageView
        android:id="@+id/ResponseAavatar"
        android:layout_width="50dp"
        android:layout_height="50dp"
        android:layout_centerVertical="true"
        android:layout_centerHorizontal="true"
        local:MvxBind="ImageUrl QuickResponse.AvatarUrl; DefaultImagePath 'res:icon_user'" />
    <ImageView
        android:src="@drawable/discussion_image_frame"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
  </RelativeLayout>
  <TextView
        android:id="@+id/txtDiscussionTitle"
        android:textDirection="locale"
        android:textAlignment="viewStart"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textSize="16sp"
        android:layout_toLeftOf="@id/FullResponseAvatar"
        android:layout_toStartOf="@id/FullResponseAvatar"
        android:textColor="@color/discussion_cell_title_text"
        local:MvxBind="Text QuickResponse.FullName" />




  <TextView
        android:id="@+id/txtListHeader"
        android:textDirection="locale"
        android:textAlignment="viewStart"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textSize="15dp"
        android:layout_marginBottom="10dp"
        android:layout_marginTop="10dp"
        android:background="@drawable/list_header"
        android:textColor="@color/discussion_cell_content_text"
        android:layout_below="@id/FullResponseAvatar"
        local:MvxBind="Text QuickResponse.ResponseTypeId, Converter=AnswerHeader" />
    <MvxListView
        android:minWidth="25px"
        android:minHeight="25px"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@id/txtListHeader"
        android:id="@+id/textAnswersListView"
        android:clickable="false"
        android:listSelector="@android:color/transparent"
        android:cacheColorHint="@android:color/transparent"
        local:MvxBind="ItemsSource TextAnswersList" />
    <RelativeLayout
        android:id="@+id/media_post_bar"
        android:layout_above="@+id/response_post_bar"
        android:background="@drawable/user_media_background"
        android:layout_width="fill_parent"
        android:layout_height="45dp">
        <ImageView
            android:id="@+id/imgPaperClip"
            android:layout_width="20dp"
            android:layout_height="18dp"
            android:layout_marginLeft="10dp"
            android:layout_marginStart="10dp"
            android:layout_marginTop="14dp"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true"
            android:src="@drawable/icon_paperclip" />
        <MvxImageView
            android:id="@+id/imgThumbnail"
            android:layout_width="35dp"
            android:layout_height="35dp"
            android:layout_marginLeft="10dp"
            android:layout_marginStart="10dp"
            android:layout_marginTop="5dp"
            android:layout_toRightOf="@+id/imgPaperClip"
            android:layout_toEndOf="@+id/imgPaperClip" />
        <ImageView
            android:id="@+id/imgTrash"
            android:layout_width="14dp"
            android:layout_height="18dp"
            android:layout_marginRight="10dp"
            android:layout_marginEnd="10dp"
            android:layout_marginTop="14dp"
            android:layout_alignParentRight="true"
            android:layout_alignParentEnd="true"
            android:src="@drawable/icon_trashcan" />
    </RelativeLayout>
    <RelativeLayout
        android:id="@+id/response_post_bar"
        android:layout_alignParentBottom="true"
        android:background="@color/responsebar_background"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content">
        <ImageView
            android:id="@+id/imgResponseCamera"
            android:layout_width="20dp"
            android:layout_height="18dp"
            android:layout_marginLeft="10dp"
            android:layout_marginStart="10dp"
            android:layout_marginTop="14dp"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true"
            android:src="@drawable/icon_camera" />
        <Button
            android:id="@+id/btnResponsePost"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginRight="10dip"
            android:layout_alignParentRight="true"
            android:layout_marginEnd="10dip"
            android:layout_alignParentEnd="true"
            android:background="@color/responsebar_background_transparent"
            android:textColor="@color/responsebar_content"
            local:MvxBind="Click PostCommand" />
        <EditText
            android:id="@+id/txtResponseText"
            android:textDirection="locale"
            android:textAlignment="viewStart"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:textSize="14dp"
            android:layout_marginTop="4dp"
            android:maxLines="10"
            android:layout_toRightOf="@id/imgResponseCamera"
            android:layout_toLeftOf="@id/btnResponsePost"
            android:layout_toEndOf="@id/imgResponseCamera"
            android:layout_toStartOf="@id/btnResponsePost"
            android:background="@drawable/responsebar_edittext"
            android:textColor="@color/responsebar_content"
            android:textColorHint="@color/responsebar_content"
            android:layout_marginLeft="5dip"
            android:layout_marginRight="5dip"
            android:layout_marginStart="5dip"
            android:layout_marginEnd="5dip"
            local:MvxBind="Text CommentText" />
    </RelativeLayout>
</RelativeLayout>

1 个答案:

答案 0 :(得分:0)

试试这个

<LinearLayout
 android:layout_width="match_parent"
 android:layout_height="match_parent"
 android:orientation="horizontal">
 <HorizontalScrollView
        android:id="@+id/discussionHorScrollView"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/scrollViewQuestion"
        android:layout_marginTop="12dp"
        android:paddingTop="10dp"
        android:paddingBottom="10dp"
        android:scrollbarFadeDuration="0">
        <LinearLayout
            android:id="@+id/discussionScrollBar"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content" />
    </HorizontalScrollView>
  <RelativeLayout
        android:id="@+id/FullResponseAvatar"
        android:layout_width="70dp"
        android:layout_height="70dp"
        android:layout_below ="@id/discussionHorScrollView"
        android:layout_alignParentRight="true"
        android:layout_marginRight="5dp">
    <MvxImageView
        android:id="@+id/ResponseAavatar"
        android:layout_width="50dp"
        android:layout_height="50dp"
        android:layout_centerVertical="true"
        android:layout_centerHorizontal="true"
        local:MvxBind="ImageUrl QuickResponse.AvatarUrl; DefaultImagePath 'res:icon_user'" />
    <ImageView
        android:src="@drawable/discussion_image_frame"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
  </RelativeLayout>
  <TextView
        android:id="@+id/txtDiscussionTitle"
        android:textDirection="locale"
        android:textAlignment="viewStart"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textSize="16sp"
        android:layout_toLeftOf="@id/FullResponseAvatar"
        android:layout_toStartOf="@id/FullResponseAvatar"
        android:textColor="@color/discussion_cell_title_text"
        local:MvxBind="Text QuickResponse.FullName" />
</LinearLayout>