是否可以使用CoordinatorLayout
和ListView
?使用CoordinatorLayout和ListView
我試圖不工作
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:minHeight="?attr/actionBarSize"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingRight="15dp">
<ru.boloid.giszkh.views.AppTextView
android:id="@+id/title_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginTop="10dp"
android:textColor="@android:color/white"
android:textSize="18sp"/>
<TextView
android:id="@+id/address_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:textColor="@android:color/white"
android:textSize="15sp"/>
</LinearLayout>
</android.support.v7.widget.Toolbar>
<LinearLayout
android:id="@+id/no_payment_documents"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/toolbar"
android:background="#EBEFF0"
android:gravity="center"
android:orientation="vertical"
android:visibility="gone">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@null"
android:src="@drawable/attention"/>
<TextView
android:id="@+id/nothing_found_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/payment_documents_nothing_found_text_margin"
android:gravity="center"
android:text="@string/payment_documents_nothing_found"/>
</LinearLayout>
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/toolbar">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:fillViewport="true">
<ListView
android:id="@+id/pay_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/footer"
android:background="@color/list_background"
android:divider="@null"
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
</android.support.v4.widget.NestedScrollView>
<!--<ListView-->
<!--android:id="@+id/pay_list"-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="wrap_content"-->
<!--android:layout_above="@+id/footer"-->
<!--android:background="@color/list_background"-->
<!--android:divider="@null"-->
<!--/>-->
<LinearLayout
android:id="@+id/footer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="@color/list_background"
app:layout_scrollFlags="scroll|enterAlways"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="16dp">
<LinearLayout
android:id="@+id/amount_to_pay_group"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/payment_documents_total_accrued"
android:textColor="@color/pay_item_title_text_color"
android:textSize="@dimen/payment_documents_footer_text_size"
android:textStyle="bold"/>
<TextView
android:id="@+id/total_accrued"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/pay_item_title_text_color"
android:textSize="@dimen/payment_documents_footer_text_size"
android:textStyle="bold"
tools:text="995 000.00 P"/>
<ImageView
android:id="@+id/info_amount_in_progress_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:contentDescription="@null"
android:scaleX="@dimen/controls_scale_1.4"
android:scaleY="@dimen/controls_scale_1.4"
android:src="@drawable/info_gray"
android:visibility="invisible"/>
</LinearLayout>
<LinearLayout
android:id="@+id/insurance_group"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/payment_documents_insurance"
android:textColor="@color/pay_item_title_text_color"
android:textSize="@dimen/payment_documents_footer_text_size"/>
<TextView
android:id="@+id/insurance_amount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/pay_item_title_text_color"
android:textSize="@dimen/payment_documents_footer_text_size"
tools:text="132.84 P"/>
<ImageView
android:id="@+id/edit_insurance_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:contentDescription="@null"
android:scaleX="@dimen/controls_scale_1.4"
android:scaleY="@dimen/controls_scale_1.4"
android:src="@drawable/ic_edit"/>
</LinearLayout>
<LinearLayout
android:id="@+id/paid_amount_group"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/payment_documents_paid"
android:textColor="@color/pay_item_title_text_color"
android:textSize="@dimen/payment_documents_footer_text_size"/>
<TextView
android:id="@+id/paid_amount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginEnd="36dp"
android:layout_marginRight="36dp"
android:layout_marginTop="8dp"
android:textColor="@color/pay_item_title_text_color"
android:textSize="@dimen/payment_documents_footer_text_size"
tools:text="1 502 000.00 P"/>
</LinearLayout>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/separator"/>
<ru.boloid.giszkh.views.AppButton
android:id="@+id/pay_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="16dp"
android:drawableLeft="@drawable/ic_card"
android:drawablePadding="10dp"
android:minWidth="130dp"/>
</LinearLayout>
</RelativeLayout>
</android.support.design.widget.CoordinatorLayout>
<View
android:layout_width="match_parent"
android:layout_height="4dp"
android:layout_below="@id/toolbar"
android:background="@drawable/bkgrd_shadow"/>
</RelativeLayout>
另外一個問題如下: 如何使我的LinearLayout滾動到頂部,當我到達的ListView的底部?
顯示你的整個XML佈局 –
沒有,使用RecyclerView – EpicPandaForce
燁運用recyclerview。檢查此https://github.com/chrisbanes/cheesesquare – Raghunandan