如何扩展 textView 并自动移动下一个字段?
How to expand textView and automatically the next fields will be moved?
我正在该文本视图中从 firebase 检索大量内容,但我只想显示 3 行,然后我想显示 "readmore/showmore" 选项,当使用时点击该完整内容将显示,然后是下一个字段会像使用滚动视图一样自动向下移动!我的信息与下一个字段重叠,有人可以帮忙吗?
<?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:expandableTextView="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:expandableTextView="http://schemas.android.com/apk/res-auto"
tools:context=".MoreDetails">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/cropimage"
android:layout_width="265dp"
android:layout_height="265dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:contentDescription="TODO"
android:scaleType="centerCrop" />
<TextView
android:id="@+id/description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="300dp"
android:text="Description :"
android:textSize="20sp"
android:autoSizeTextType="uniform"
android:autoSizeMinTextSize="12sp"
android:autoSizeMaxTextSize="20sp"/>
<com.borjabravo.readmoretextview.ReadMoreTextView
android:id="@+id/description_info"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="330dp"
android:textSize="15sp"
app:trimCollapsedText="@string/read_more"
app:trimExpandedText="@string/read_less"
app:trimMode="trimModeLength"
app:trimLength="180"
app:colorClickableText="#000"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="100"
android:paddingTop="430dp">
<TextView
android:id="@+id/planting_time"
android:layout_width="match_parent"
android:layout_height="100dp"
android:text="planting time :"
android:gravity="center"
android:textSize="20sp"
android:layout_weight="60" />
<TextView
android:id="@+id/planting_time_info"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:autoSizeTextType="uniform"
android:autoSizeMinTextSize="12sp"
android:autoSizeMaxTextSize="20sp"
android:maxLines="16"
android:layout_weight="40"/>
</LinearLayout>
<View
android:layout_width="wrap_content"
android:layout_height="2dp"
android:background="@color/colorPrimary"
android:layout_marginTop="420dp"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="100"
android:paddingTop="530dp">
<TextView
android:id="@+id/bloom_time"
android:layout_width="match_parent"
android:layout_height="100dp"
android:text="bloom time :"
android:gravity="center"
android:textSize="20sp"
android:layout_weight="60" />
<TextView
android:id="@+id/bloom_time_info"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:autoSizeTextType="uniform"
android:autoSizeMinTextSize="12sp"
android:autoSizeMaxTextSize="20sp"
android:maxLines="16"
android:layout_weight="40"/>
</LinearLayout>
<View
android:layout_width="wrap_content"
android:layout_height="2dp"
android:background="@color/colorPrimary"
android:layout_marginTop="530dp"/>
喜欢的描述有maxLines=3
<TextView
android:id="@+id/description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="300dp"
android:text="Description :"
android:textSize="20sp"
android:maxLines="3"
android:autoSizeTextType="uniform"
android:autoSizeMinTextSize="12sp"
android:autoSizeMaxTextSize="20sp"/>
现在您想在单击后将行变成文本行,然后在 java
中执行此操作
description.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
description.setLines(description.getLineCount());
}
});
希望有用
谢谢!编码愉快!
我正在该文本视图中从 firebase 检索大量内容,但我只想显示 3 行,然后我想显示 "readmore/showmore" 选项,当使用时点击该完整内容将显示,然后是下一个字段会像使用滚动视图一样自动向下移动!我的信息与下一个字段重叠,有人可以帮忙吗?
<?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:expandableTextView="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:expandableTextView="http://schemas.android.com/apk/res-auto"
tools:context=".MoreDetails">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/cropimage"
android:layout_width="265dp"
android:layout_height="265dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:contentDescription="TODO"
android:scaleType="centerCrop" />
<TextView
android:id="@+id/description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="300dp"
android:text="Description :"
android:textSize="20sp"
android:autoSizeTextType="uniform"
android:autoSizeMinTextSize="12sp"
android:autoSizeMaxTextSize="20sp"/>
<com.borjabravo.readmoretextview.ReadMoreTextView
android:id="@+id/description_info"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="330dp"
android:textSize="15sp"
app:trimCollapsedText="@string/read_more"
app:trimExpandedText="@string/read_less"
app:trimMode="trimModeLength"
app:trimLength="180"
app:colorClickableText="#000"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="100"
android:paddingTop="430dp">
<TextView
android:id="@+id/planting_time"
android:layout_width="match_parent"
android:layout_height="100dp"
android:text="planting time :"
android:gravity="center"
android:textSize="20sp"
android:layout_weight="60" />
<TextView
android:id="@+id/planting_time_info"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:autoSizeTextType="uniform"
android:autoSizeMinTextSize="12sp"
android:autoSizeMaxTextSize="20sp"
android:maxLines="16"
android:layout_weight="40"/>
</LinearLayout>
<View
android:layout_width="wrap_content"
android:layout_height="2dp"
android:background="@color/colorPrimary"
android:layout_marginTop="420dp"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="100"
android:paddingTop="530dp">
<TextView
android:id="@+id/bloom_time"
android:layout_width="match_parent"
android:layout_height="100dp"
android:text="bloom time :"
android:gravity="center"
android:textSize="20sp"
android:layout_weight="60" />
<TextView
android:id="@+id/bloom_time_info"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:autoSizeTextType="uniform"
android:autoSizeMinTextSize="12sp"
android:autoSizeMaxTextSize="20sp"
android:maxLines="16"
android:layout_weight="40"/>
</LinearLayout>
<View
android:layout_width="wrap_content"
android:layout_height="2dp"
android:background="@color/colorPrimary"
android:layout_marginTop="530dp"/>
喜欢的描述有maxLines=3
<TextView
android:id="@+id/description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="300dp"
android:text="Description :"
android:textSize="20sp"
android:maxLines="3"
android:autoSizeTextType="uniform"
android:autoSizeMinTextSize="12sp"
android:autoSizeMaxTextSize="20sp"/>
现在您想在单击后将行变成文本行,然后在 java
中执行此操作description.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
description.setLines(description.getLineCount());
}
});
希望有用
谢谢!编码愉快!