Skip to content

Commit

Permalink
布局调整
Browse files Browse the repository at this point in the history
  • Loading branch information
alidili committed Oct 19, 2017
1 parent 03ab11c commit 20eac25
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 20 deletions.
2 changes: 1 addition & 1 deletion RecyclerViewRefreshDemo/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;

Expand Down Expand Up @@ -77,19 +78,19 @@ public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
case LOADING: // 正在加载
footViewHolder.pbLoading.setVisibility(View.VISIBLE);
footViewHolder.tvLoading.setVisibility(View.VISIBLE);
footViewHolder.tvEnd.setVisibility(View.GONE);
footViewHolder.llEnd.setVisibility(View.GONE);
break;

case LOADING_COMPLETE: // 加载完成
footViewHolder.pbLoading.setVisibility(View.INVISIBLE);
footViewHolder.tvLoading.setVisibility(View.INVISIBLE);
footViewHolder.tvEnd.setVisibility(View.GONE);
footViewHolder.llEnd.setVisibility(View.GONE);
break;

case LOADING_END: // 加载到底
footViewHolder.pbLoading.setVisibility(View.GONE);
footViewHolder.tvLoading.setVisibility(View.GONE);
footViewHolder.tvEnd.setVisibility(View.VISIBLE);
footViewHolder.llEnd.setVisibility(View.VISIBLE);
break;

default:
Expand Down Expand Up @@ -133,13 +134,13 @@ private class FootViewHolder extends RecyclerView.ViewHolder {

ProgressBar pbLoading;
TextView tvLoading;
TextView tvEnd;
LinearLayout llEnd;

FootViewHolder(View itemView) {
super(itemView);
pbLoading = (ProgressBar) itemView.findViewById(R.id.pb_loading);
tvLoading = (TextView) itemView.findViewById(R.id.tv_loading);
tvEnd = (TextView) itemView.findViewById(R.id.tv_end);
llEnd = (LinearLayout) itemView.findViewById(R.id.ll_end);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;

Expand Down Expand Up @@ -66,19 +67,19 @@ public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
case LOADING: // 正在加载
footViewHolder.pbLoading.setVisibility(View.VISIBLE);
footViewHolder.tvLoading.setVisibility(View.VISIBLE);
footViewHolder.tvEnd.setVisibility(View.GONE);
footViewHolder.llEnd.setVisibility(View.GONE);
break;

case LOADING_COMPLETE: // 加载完成
footViewHolder.pbLoading.setVisibility(View.INVISIBLE);
footViewHolder.tvLoading.setVisibility(View.INVISIBLE);
footViewHolder.tvEnd.setVisibility(View.GONE);
footViewHolder.llEnd.setVisibility(View.GONE);
break;

case LOADING_END: // 加载到底
footViewHolder.pbLoading.setVisibility(View.GONE);
footViewHolder.tvLoading.setVisibility(View.GONE);
footViewHolder.tvEnd.setVisibility(View.VISIBLE);
footViewHolder.llEnd.setVisibility(View.VISIBLE);
break;

default:
Expand Down Expand Up @@ -114,13 +115,13 @@ private class FootViewHolder extends RecyclerView.ViewHolder {

ProgressBar pbLoading;
TextView tvLoading;
TextView tvEnd;
LinearLayout llEnd;

FootViewHolder(View itemView) {
super(itemView);
pbLoading = (ProgressBar) itemView.findViewById(R.id.pb_loading);
tvLoading = (TextView) itemView.findViewById(R.id.tv_loading);
tvEnd = (TextView) itemView.findViewById(R.id.tv_end);
llEnd = (LinearLayout) itemView.findViewById(R.id.ll_end);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="70dp">
android:layout_height="60dp">

<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_height="50dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
card_view:cardCornerRadius="8dp">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,45 @@
android:layout_height="wrap_content"
android:padding="15dp"
android:text="正在加载..."
android:textColor="#4DB6AC"
android:textSize="16sp" />

<TextView
android:id="@+id/tv_end"
android:layout_width="wrap_content"
<LinearLayout
android:id="@+id/ll_end"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="15dp"
android:text="---------- 我是有底线的 ----------"
android:textSize="16sp"
android:visibility="gone" />
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:gravity="center_vertical"
android:orientation="horizontal"
android:visibility="gone">

<View
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_weight="1"
android:alpha="0.5"
android:background="#4DB6AC"
android:gravity="start" />

<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1.2"
android:gravity="center"
android:padding="15dp"
android:text="我是有底线的"
android:textColor="#4DB6AC"
android:textSize="16sp" />

<View
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_weight="1"
android:alpha="0.5"
android:background="#4DB6AC"
android:gravity="end" />

</LinearLayout>

</LinearLayout>

0 comments on commit 20eac25

Please sign in to comment.