以下是我试图实施的布局xml代码,我不知道背后的问题是什么有人可以帮助我吗?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/activity_post"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:orientation="vertical"
android:weightSum="1">
<ScrollView
android:fillViewport="true"
android:layout_weight="0.95"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
tools:ignore="NestedWeights"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_weight="0.05"
tools:ignore="NestedWeights"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="0dp">
<TextView
tools:ignore="NestedWeights"
android:id="@+id/etSearch"
android:maxLines="1"
android:layout_weight="0.9"
android:gravity="center"
android:padding="@dimen/value_3"
android:textColor="@color/black"
android:layout_width="0dp"
android:textSize="@dimen/font_14"
android:background="@drawable/bg"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/search_text"/>
<FrameLayout
android:background="@drawable/tab_bg_selector"
android:id="@+id/imgChat"
tools:ignore="NestedWeights"
android:layout_gravity="center"
android:layout_weight="0.1"
android:layout_margin="@dimen/value_5"
android:layout_width="0dp"
android:layout_height="@dimen/value_30">
<TextView
android:gravity="center"
android:id="@+id/msgCount"
android:textSize="@dimen/font_14"
android:textColor="@android:color/white"
android:background="@drawable/round"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="@dimen/value_20" />
<ImageView
android:visibility="gone"
android:id="@+id/imgMsg"
android:src="@drawable/chatt"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</FrameLayout>
</LinearLayout>
<!--<LinearLayout />-->
<LinearLayout
android:layout_weight="0.9"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="0dp">
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/swiperefresh"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:descendantFocusability="blocksDescendants"
tools:ignore="NestedWeights"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<LinearLayout
android:orientation="vertical"
android:background="@color/rv_color"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
tools:ignore="NestedWeights"
android:layout_centerInParent="true"
android:id="@+id/rvHairList"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="false" />
</LinearLayout>
<ProgressBar
android:indeterminateTint="@color/user_name"
android:id="@+id/main_progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"/>
<include
layout="@layout/error_layout"/>
</LinearLayout>
</android.support.v4.widget.SwipeRefreshLayout>
</LinearLayout>
</LinearLayout>
</ScrollView>
<LinearLayout
android:layout_weight="0.05"
android:gravity="bottom"
android:layout_gravity="bottom"
android:background="@color/white"
tools:ignore="NestedWeights"
android:padding="@dimen/value_5"
android:layout_alignParentBottom="true"
android:layout_width="match_parent"
android:layout_height="0dp"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/llDrawer"
android:gravity="center"
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="match_parent">
<ImageView
android:id="@+id/drawer"
android:layout_gravity="center"
tools:ignore="NestedWeights"
android:layout_marginRight="@dimen/value_5"
android:layout_marginLeft="@dimen/value_5"
android:layout_width="@dimen/value_30"
android:layout_height="@dimen/value_20"
android:src="@drawable/more"/>
</LinearLayout>
<LinearLayout
android:id="@+id/llHome"
android:gravity="center"
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="match_parent">
<ImageView
android:id="@+id/imgHome"
android:layout_gravity="center"
tools:ignore="NestedWeights"
android:layout_marginRight="@dimen/value_5"
android:layout_marginLeft="@dimen/value_5"
android:layout_width="@dimen/value_30"
android:layout_height="@dimen/value_20"
android:src="@drawable/home"/>
</LinearLayout>
<FrameLayout
android:id="@+id/imgFriendRequest"
tools:ignore="NestedWeights"
android:layout_gravity="center"
android:layout_weight="1"
android:layout_marginRight="@dimen/value_5"
android:layout_marginLeft="@dimen/value_5"
android:layout_width="@dimen/value_30"
android:layout_height="@dimen/value_20">
<TextView
android:gravity="center"
android:id="@+id/friendCount"
android:textSize="@dimen/font_14"
android:textColor="@android:color/white"
android:background="@drawable/round"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<ImageView
android:visibility="gone"
android:id="@+id/imgFnd"
android:src="@drawable/add_friend"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</FrameLayout>
<LinearLayout
android:visibility="gone"
android:gravity="center"
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="match_parent">
<ImageView
android:id="@+id/gestureImg"
android:layout_gravity="center"
tools:ignore="NestedWeights"
android:layout_marginRight="@dimen/value_5"
android:layout_marginLeft="@dimen/value_5"
android:layout_width="@dimen/value_30"
android:layout_height="@dimen/value_20"
android:src="@drawable/img_thing"/>
</LinearLayout>
<LinearLayout
android:id="@+id/llNewPost"
android:gravity="center"
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="match_parent">
<ImageView
android:id="@+id/imgGallery"
android:layout_gravity="center"
tools:ignore="NestedWeights"
android:layout_marginRight="@dimen/value_5"
android:layout_marginLeft="@dimen/value_5"
android:layout_width="@dimen/value_30"
android:layout_height="@dimen/value_20"
android:src="@drawable/gallery"/>
</LinearLayout>
<FrameLayout
android:id="@+id/imgNotification"
tools:ignore="NestedWeights"
android:layout_gravity="center"
android:layout_weight="1"
android:layout_marginRight="@dimen/value_5"
android:layout_marginLeft="@dimen/value_5"
android:layout_width="@dimen/value_30"
android:layout_height="@dimen/value_20">
<TextView
android:gravity="center"
android:id="@+id/notiCount"
android:textSize="@dimen/font_14"
android:textColor="@android:color/white"
android:background="@drawable/round"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<ImageView
android:visibility="gone"
android:id="@+id/imgNoti"
android:src="@drawable/notification"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</FrameLayout>
<LinearLayout
android:id="@+id/llProfile"
android:gravity="center"
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="match_parent">
<de.hdodenhof.circleimageview.CircleImageView
android:layout_gravity="center"
android:layout_weight="1"
tools:ignore="NestedWeights"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/imgTimeline"
android:layout_width="@dimen/value_30"
android:layout_height="@dimen/value_20"
android:src="@drawable/loader"
android:layout_marginRight="@dimen/value_5"
android:layout_marginLeft="@dimen/value_5"
app:civ_border_color="#FF000000"/>
</LinearLayout>
</LinearLayout>
scrollview不滚动
我试图改变scrollview的高度和scrollview的linearlayout,但没有得到任何解决方案
答案 0 :(得分:0)
在android中设置0dp而不是wrap_content:layout_height =“wrap_content”
<ScrollView
android:fillViewport="true"
android:layout_weight="0.95"
android:layout_width="match_parent"
android:layout_height="0dp">
答案 1 :(得分:0)
您已管理
weight
和ScrollView
的{{1}}并修复 底部的LinearLayout高度,如下面
Layout's