version:
fix: update:增加资讯列表
This commit is contained in:
@@ -78,6 +78,7 @@
|
|||||||
<activity android:name=".activity.QuickAppActivity" />
|
<activity android:name=".activity.QuickAppActivity" />
|
||||||
<activity android:name=".activity.SpikeListActivity" />
|
<activity android:name=".activity.SpikeListActivity" />
|
||||||
<activity android:name=".activity.InfoListActivity" />
|
<activity android:name=".activity.InfoListActivity" />
|
||||||
|
<activity android:name=".activity.ArticleActivity" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".activity.DetailsActivity"
|
android:name=".activity.DetailsActivity"
|
||||||
android:screenOrientation="userPortrait"
|
android:screenOrientation="userPortrait"
|
||||||
|
|||||||
106
app/src/main/java/com/uiuios/aios/activity/ArticleActivity.java
Normal file
106
app/src/main/java/com/uiuios/aios/activity/ArticleActivity.java
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
package com.uiuios.aios.activity;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.graphics.Bitmap;
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.view.ViewTreeObserver;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import com.bumptech.glide.Glide;
|
||||||
|
import com.bumptech.glide.request.target.CustomTarget;
|
||||||
|
import com.bumptech.glide.request.transition.Transition;
|
||||||
|
import com.shehuan.niv.NiceImageView;
|
||||||
|
import com.uiuios.aios.R;
|
||||||
|
import com.uiuios.aios.base.BaseActivity;
|
||||||
|
import com.uiuios.aios.bean.ArticleInfo;
|
||||||
|
import com.zackratos.ultimatebarx.ultimatebarx.java.UltimateBarX;
|
||||||
|
|
||||||
|
import butterknife.BindView;
|
||||||
|
import butterknife.ButterKnife;
|
||||||
|
|
||||||
|
public class ArticleActivity extends BaseActivity {
|
||||||
|
@BindView(R.id.iv_back)
|
||||||
|
ImageView iv_back;
|
||||||
|
@BindView(R.id.tv_title)
|
||||||
|
TextView tv_title;
|
||||||
|
@BindView(R.id.tv_content)
|
||||||
|
TextView tv_content;
|
||||||
|
@BindView(R.id.iv_img)
|
||||||
|
NiceImageView iv_img;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getLayoutId() {
|
||||||
|
UltimateBarX.statusBar(this)
|
||||||
|
.transparent()
|
||||||
|
.colorRes(R.color.colorPrimaryDark)
|
||||||
|
.light(true)
|
||||||
|
.apply();
|
||||||
|
UltimateBarX.navigationBar(this)
|
||||||
|
.transparent()
|
||||||
|
.colorRes(R.color.colorPrimaryDark)
|
||||||
|
.light(true)
|
||||||
|
.apply();
|
||||||
|
return R.layout.activity_articl;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initView() {
|
||||||
|
ButterKnife.bind(this);
|
||||||
|
Intent intent = getIntent();
|
||||||
|
if (intent == null) {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
ArticleInfo articleInfo = (ArticleInfo) intent.getSerializableExtra("ArticleInfo");
|
||||||
|
if (articleInfo == null) {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
iv_back.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
tv_title.setText(articleInfo.getTitle());
|
||||||
|
tv_content.setText(articleInfo.getContent());
|
||||||
|
ViewTreeObserver observer = iv_img.getViewTreeObserver();
|
||||||
|
observer.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
|
||||||
|
@Override
|
||||||
|
public void onGlobalLayout() {
|
||||||
|
ViewGroup.LayoutParams layoutParams = iv_img.getLayoutParams();
|
||||||
|
int width = iv_img.getWidth();
|
||||||
|
// layoutParams.height = width;
|
||||||
|
// iv_img.setLayoutParams(layoutParams);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Glide.with(iv_img).asBitmap().load(articleInfo.getImg()).into(new CustomTarget<Bitmap>() {
|
||||||
|
@Override
|
||||||
|
public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
|
||||||
|
int imgWidth = resource.getWidth();
|
||||||
|
int imgHeight = resource.getHeight();
|
||||||
|
iv_img.setImageBitmap(resource);
|
||||||
|
Log.e("into", "onResourceReady: width = " + imgWidth + "height = " + imgHeight);
|
||||||
|
ViewGroup.LayoutParams layoutParams = iv_img.getLayoutParams();
|
||||||
|
int width = iv_img.getWidth();
|
||||||
|
layoutParams.height = (int) (imgHeight * (1.0f * width /imgWidth ));
|
||||||
|
iv_img.setLayoutParams(layoutParams);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLoadCleared(@Nullable Drawable placeholder) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initData() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,21 +1,101 @@
|
|||||||
package com.uiuios.aios.activity;
|
package com.uiuios.aios.activity;
|
||||||
|
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.trello.rxlifecycle4.RxLifecycle;
|
||||||
|
import com.trello.rxlifecycle4.android.ActivityEvent;
|
||||||
|
import com.trello.rxlifecycle4.android.FragmentEvent;
|
||||||
import com.uiuios.aios.R;
|
import com.uiuios.aios.R;
|
||||||
|
import com.uiuios.aios.adapter.ArticleAdapter;
|
||||||
import com.uiuios.aios.base.BaseActivity;
|
import com.uiuios.aios.base.BaseActivity;
|
||||||
|
import com.uiuios.aios.bean.ArticleInfo;
|
||||||
|
import com.uiuios.aios.bean.BaseResponse;
|
||||||
|
import com.uiuios.aios.network.NetInterfaceManager;
|
||||||
|
import com.zackratos.ultimatebarx.ultimatebarx.java.UltimateBarX;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import butterknife.BindView;
|
||||||
|
import butterknife.ButterKnife;
|
||||||
|
import io.reactivex.rxjava3.annotations.NonNull;
|
||||||
|
import io.reactivex.rxjava3.core.Observer;
|
||||||
|
import io.reactivex.rxjava3.disposables.Disposable;
|
||||||
|
|
||||||
public class InfoListActivity extends BaseActivity {
|
public class InfoListActivity extends BaseActivity {
|
||||||
|
@BindView(R.id.iv_back)
|
||||||
|
ImageView iv_back;
|
||||||
|
@BindView(R.id.iv1)
|
||||||
|
ImageView iv1;
|
||||||
|
@BindView(R.id.recyclerView)
|
||||||
|
RecyclerView recyclerView;
|
||||||
|
|
||||||
|
private ArticleAdapter mArticleAdapter;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getLayoutId() {
|
public int getLayoutId() {
|
||||||
|
UltimateBarX.statusBar(this)
|
||||||
|
.transparent()
|
||||||
|
.colorRes(R.color.colorPrimaryDark)
|
||||||
|
.light(true)
|
||||||
|
.apply();
|
||||||
|
UltimateBarX.navigationBar(this)
|
||||||
|
.transparent()
|
||||||
|
.colorRes(R.color.colorPrimaryDark)
|
||||||
|
.light(true)
|
||||||
|
.apply();
|
||||||
return R.layout.activity_info_list;
|
return R.layout.activity_info_list;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initView() {
|
public void initView() {
|
||||||
|
ButterKnife.bind(this);
|
||||||
|
mArticleAdapter = new ArticleAdapter();
|
||||||
|
recyclerView.setLayoutManager(new LinearLayoutManager(this));
|
||||||
|
recyclerView.setAdapter(mArticleAdapter);
|
||||||
|
iv_back.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initData() {
|
public void initData() {
|
||||||
|
NetInterfaceManager.getInstance().getArticleListObservable()
|
||||||
|
.compose(RxLifecycle.bindUntilEvent(lifecycleSubject, ActivityEvent.DESTROY))
|
||||||
|
.subscribe(new Observer<BaseResponse<List<ArticleInfo>>>() {
|
||||||
|
@Override
|
||||||
|
public void onSubscribe(@NonNull Disposable d) {
|
||||||
|
Log.e("getArticle", "onSubscribe: ");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNext(@NonNull BaseResponse<List<ArticleInfo>> listBaseResponse) {
|
||||||
|
Log.e("getArticle", "onNext: " + listBaseResponse);
|
||||||
|
List<ArticleInfo> articleInfoList = listBaseResponse.data;
|
||||||
|
if (articleInfoList != null && articleInfoList.size() != 0) {
|
||||||
|
iv1.setVisibility(android.view.View.GONE);
|
||||||
|
mArticleAdapter.setArticleBeanList(articleInfoList);
|
||||||
|
} else {
|
||||||
|
iv1.setVisibility(android.view.View.VISIBLE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(@NonNull Throwable e) {
|
||||||
|
Log.e("getArticle", "onError: " + e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onComplete() {
|
||||||
|
Log.e("getArticle", "onComplete: ");
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
package com.uiuios.aios.adapter;
|
package com.uiuios.aios.adapter;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.ImageView;
|
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
@@ -13,6 +13,7 @@ import androidx.recyclerview.widget.RecyclerView;
|
|||||||
import com.bumptech.glide.Glide;
|
import com.bumptech.glide.Glide;
|
||||||
import com.shehuan.niv.NiceImageView;
|
import com.shehuan.niv.NiceImageView;
|
||||||
import com.uiuios.aios.R;
|
import com.uiuios.aios.R;
|
||||||
|
import com.uiuios.aios.activity.ArticleActivity;
|
||||||
import com.uiuios.aios.bean.ArticleInfo;
|
import com.uiuios.aios.bean.ArticleInfo;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -40,6 +41,14 @@ public class ArticleAdapter extends RecyclerView.Adapter<ArticleAdapter.Holder>
|
|||||||
Glide.with(holder.iv_img).load(articleInfo.getImg()).into(holder.iv_img);
|
Glide.with(holder.iv_img).load(articleInfo.getImg()).into(holder.iv_img);
|
||||||
holder.tv_title.setText(articleInfo.getTitle());
|
holder.tv_title.setText(articleInfo.getTitle());
|
||||||
holder.tv_content.setText(articleInfo.getContent());
|
holder.tv_content.setText(articleInfo.getContent());
|
||||||
|
holder.tv_read.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
Intent intent = new Intent(mContext, ArticleActivity.class);
|
||||||
|
intent.putExtra("ArticleInfo", articleInfo);
|
||||||
|
mContext.startActivity(intent);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -49,13 +58,16 @@ public class ArticleAdapter extends RecyclerView.Adapter<ArticleAdapter.Holder>
|
|||||||
|
|
||||||
class Holder extends RecyclerView.ViewHolder {
|
class Holder extends RecyclerView.ViewHolder {
|
||||||
NiceImageView iv_img;
|
NiceImageView iv_img;
|
||||||
TextView tv_title, tv_content;
|
TextView tv_title;
|
||||||
|
TextView tv_content;
|
||||||
|
TextView tv_read;
|
||||||
|
|
||||||
public Holder(@NonNull View itemView) {
|
public Holder(@NonNull View itemView) {
|
||||||
super(itemView);
|
super(itemView);
|
||||||
iv_img = itemView.findViewById(R.id.iv_img);
|
iv_img = itemView.findViewById(R.id.iv_img);
|
||||||
tv_title = itemView.findViewById(R.id.tv_title);
|
tv_title = itemView.findViewById(R.id.tv_title);
|
||||||
tv_content = itemView.findViewById(R.id.tv_content);
|
tv_content = itemView.findViewById(R.id.tv_content);
|
||||||
|
tv_read = itemView.findViewById(R.id.tv_read);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
135
app/src/main/java/com/uiuios/aios/view/ExpandTextView.java
Normal file
135
app/src/main/java/com/uiuios/aios/view/ExpandTextView.java
Normal file
@@ -0,0 +1,135 @@
|
|||||||
|
package com.uiuios.aios.view;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.graphics.Rect;
|
||||||
|
import android.text.Layout;
|
||||||
|
import android.text.StaticLayout;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.appcompat.widget.AppCompatTextView;
|
||||||
|
|
||||||
|
public class ExpandTextView extends AppCompatTextView {
|
||||||
|
/**
|
||||||
|
* true:展开,false:收起
|
||||||
|
*/
|
||||||
|
boolean mExpanded;
|
||||||
|
/**
|
||||||
|
* 状态回调
|
||||||
|
*/
|
||||||
|
Callback mCallback;
|
||||||
|
/**
|
||||||
|
* 源文字内容
|
||||||
|
*/
|
||||||
|
String mText = "";
|
||||||
|
/**
|
||||||
|
* 最多展示的行数
|
||||||
|
*/
|
||||||
|
final int maxLineCount = 3;
|
||||||
|
/**
|
||||||
|
* 省略文字
|
||||||
|
*/
|
||||||
|
final String ellipsizeText = "...";
|
||||||
|
|
||||||
|
public ExpandTextView(Context context, @Nullable AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||||
|
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||||
|
// 文字计算辅助工具
|
||||||
|
StaticLayout sl = new StaticLayout(mText, getPaint(), getMeasuredWidth() - getPaddingLeft() - getPaddingRight()
|
||||||
|
, Layout.Alignment.ALIGN_CENTER, 1, 0, true);
|
||||||
|
// 总计行数
|
||||||
|
int lineCount = sl.getLineCount();
|
||||||
|
if (lineCount > maxLineCount) {
|
||||||
|
if (mExpanded) {
|
||||||
|
setText(mText);
|
||||||
|
mCallback.onExpand();
|
||||||
|
} else {
|
||||||
|
lineCount = maxLineCount;
|
||||||
|
|
||||||
|
// 省略文字的宽度
|
||||||
|
float dotWidth = getPaint().measureText(ellipsizeText);
|
||||||
|
|
||||||
|
// 找出第 showLineCount 行的文字
|
||||||
|
int start = sl.getLineStart(lineCount - 1);
|
||||||
|
int end = sl.getLineEnd(lineCount - 1);
|
||||||
|
String lineText = mText.substring(start, end);
|
||||||
|
|
||||||
|
// 将第 showLineCount 行最后的文字替换为 ellipsizeText
|
||||||
|
int endIndex = 0;
|
||||||
|
for (int i = lineText.length() - 1; i >= 0; i--) {
|
||||||
|
String str = lineText.substring(i, lineText.length());
|
||||||
|
// 找出文字宽度大于 ellipsizeText 的字符
|
||||||
|
if (getPaint().measureText(str) >= dotWidth) {
|
||||||
|
endIndex = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新的第 showLineCount 的文字
|
||||||
|
String newEndLineText = lineText.substring(0, endIndex) + ellipsizeText;
|
||||||
|
// 最终显示的文字
|
||||||
|
setText(mText.substring(0, start) + newEndLineText);
|
||||||
|
|
||||||
|
mCallback.onCollapse();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
setText(mText);
|
||||||
|
mCallback.onLoss();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 重新计算高度
|
||||||
|
int lineHeight = 0;
|
||||||
|
for (int i = 0; i < lineCount; i++) {
|
||||||
|
Rect lineBound = new Rect();
|
||||||
|
sl.getLineBounds(i, lineBound);
|
||||||
|
lineHeight += lineBound.height();
|
||||||
|
}
|
||||||
|
lineHeight += getPaddingTop() + getPaddingBottom();
|
||||||
|
setMeasuredDimension(getMeasuredWidth(), lineHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置要显示的文字以及状态
|
||||||
|
* @param text
|
||||||
|
* @param expanded true:展开,false:收起
|
||||||
|
* @param callback
|
||||||
|
*/
|
||||||
|
public void setText(String text, boolean expanded, Callback callback) {
|
||||||
|
mText = text;
|
||||||
|
mExpanded = expanded;
|
||||||
|
mCallback = callback;
|
||||||
|
|
||||||
|
// 设置要显示的文字,这一行必须要,否则 onMeasure 宽度测量不正确
|
||||||
|
setText(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 展开收起状态变化
|
||||||
|
* @param expanded
|
||||||
|
*/
|
||||||
|
public void setChanged(boolean expanded) {
|
||||||
|
mExpanded = expanded;
|
||||||
|
requestLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface Callback {
|
||||||
|
/**
|
||||||
|
* 展开状态
|
||||||
|
*/
|
||||||
|
void onExpand();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 收起状态
|
||||||
|
*/
|
||||||
|
void onCollapse();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 行数小于最小行数,不满足展开或者收起条件
|
||||||
|
*/
|
||||||
|
void onLoss();
|
||||||
|
}
|
||||||
|
}
|
||||||
94
app/src/main/res/layout/activity_articl.xml
Normal file
94
app/src/main/res/layout/activity_articl.xml
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@color/white">
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:id="@+id/constraintLayout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="@dimen/dp_36"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_back"
|
||||||
|
android:layout_width="@dimen/dp_20"
|
||||||
|
android:layout_height="@dimen/dp_20"
|
||||||
|
android:layout_marginStart="8dp"
|
||||||
|
android:adjustViewBounds="true"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
android:src="@drawable/back_black"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="@dimen/dp_4"
|
||||||
|
android:text="返回"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
android:textSize="@dimen/sp_18"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toEndOf="@+id/iv_back"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
<ScrollView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/constraintLayout">
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_title"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="@dimen/dp_16"
|
||||||
|
android:layout_marginTop="@dimen/dp_16"
|
||||||
|
android:layout_marginEnd="@dimen/dp_16"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
android:textSize="@dimen/sp_19"
|
||||||
|
android:textStyle="bold"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<com.shehuan.niv.NiceImageView
|
||||||
|
android:id="@+id/iv_img"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="@dimen/dp_200"
|
||||||
|
android:layout_marginStart="@dimen/dp_16"
|
||||||
|
android:layout_marginTop="@dimen/dp_16"
|
||||||
|
android:layout_marginEnd="@dimen/dp_16"
|
||||||
|
android:adjustViewBounds="true"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
app:corner_radius="@dimen/dp_8"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/tv_title" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_content"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="@dimen/dp_16"
|
||||||
|
android:layout_marginTop="@dimen/dp_16"
|
||||||
|
android:layout_marginEnd="@dimen/dp_16"
|
||||||
|
android:textSize="@dimen/sp_13"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/iv_img" />
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
</ScrollView>
|
||||||
|
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
@@ -1,10 +1,102 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_height="match_parent">
|
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"/>
|
android:layout_height="match_parent"
|
||||||
|
android:background="@color/gray">
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:id="@+id/constraintLayout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="@dimen/dp_36"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_back"
|
||||||
|
android:layout_width="@dimen/dp_20"
|
||||||
|
android:layout_height="@dimen/dp_20"
|
||||||
|
android:layout_marginStart="8dp"
|
||||||
|
android:adjustViewBounds="true"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
android:src="@drawable/back_black"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="@dimen/dp_24"
|
||||||
|
android:layout_marginStart="@dimen/dp_8"
|
||||||
|
android:layout_marginEnd="@dimen/dp_16"
|
||||||
|
android:background="@drawable/search_bg"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toEndOf="@+id/iv_back"
|
||||||
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/imageView9"
|
||||||
|
android:layout_width="@dimen/dp_16"
|
||||||
|
android:layout_height="@dimen/dp_16"
|
||||||
|
android:layout_marginStart="@dimen/dp_16"
|
||||||
|
android:adjustViewBounds="true"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
android:src="@drawable/search_icon"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="@dimen/dp_8"
|
||||||
|
android:text="搜索"
|
||||||
|
android:textColor="@color/title_gray"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toEndOf="@+id/imageView9"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv1"
|
||||||
|
android:layout_width="@dimen/dp_64"
|
||||||
|
android:layout_height="@dimen/dp_64"
|
||||||
|
android:adjustViewBounds="true"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
android:src="@drawable/nodata"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<com.google.android.material.tabs.TabLayout
|
||||||
|
android:id="@+id/tabLayout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/constraintLayout">
|
||||||
|
|
||||||
|
<com.google.android.material.tabs.TabItem
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="养身" />
|
||||||
|
|
||||||
|
<com.google.android.material.tabs.TabItem
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="防疫" />
|
||||||
|
</com.google.android.material.tabs.TabLayout>
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/recyclerView"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/tabLayout" />
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
@@ -35,13 +35,13 @@
|
|||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
android:text="中医专家谈寒露养生 “晨饮盐水晚喝蜂蜜”更健康"
|
android:text="中医专家谈寒露养生 “晨饮盐水晚喝蜂蜜”更健康"
|
||||||
android:textSize="@dimen/sp_9"
|
android:textSize="@dimen/sp_9"
|
||||||
app:layout_constraintBottom_toTopOf="@+id/tv_buying"
|
app:layout_constraintBottom_toTopOf="@+id/tv_read"
|
||||||
app:layout_constraintEnd_toEndOf="@+id/tv_title"
|
app:layout_constraintEnd_toEndOf="@+id/tv_title"
|
||||||
app:layout_constraintStart_toStartOf="@+id/tv_title"
|
app:layout_constraintStart_toStartOf="@+id/tv_title"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/tv_title" />
|
app:layout_constraintTop_toBottomOf="@+id/tv_title" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_buying"
|
android:id="@+id/tv_read"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="@drawable/buying_bg"
|
android:background="@drawable/buying_bg"
|
||||||
|
|||||||
Reference in New Issue
Block a user