Procházet zdrojové kódy

优化实时奖励滚动UI,去除LinearLayout,以Textview做为根节点

zhanghai před 8 roky
rodič
revize
49391659bf

+ 5 - 3
app/src/main/java/com/kfzs/duanduan/fragment/FgtSmallSheep.java

@@ -245,13 +245,15 @@ public class FgtSmallSheep extends BaseCompatFragment implements SmallSheepContr
     }
     private  void  invite(final List<MoreDataEntity> loginEty){
         for (MoreDataEntity entity:loginEty) {
-            LinearLayout moreView = (LinearLayout) LayoutInflater.from(getActivity()).inflate(R.layout.x_item_view, null);
             StringBuilder  sb=new StringBuilder();
-            TextView tv_desc = moreView.findViewById(R.id.tv_desc);
             sb.append(TimeStamp2Date(entity.getTime())+"   ");
             sb.append(entity.getName()+"   ");
             sb.append(entity.getDesc());
-            tv_desc.setText(sb.toString());
+//            LinearLayout moreView = (LinearLayout) LayoutInflater.from(getActivity()).inflate(R.layout.x_item_view, null);
+//            TextView tv_desc = moreView.findViewById(R.id.tv_desc);
+//            tv_desc.setText(sb.toString());
+            TextView moreView = (TextView) LayoutInflater.from(getActivity()).inflate(R.layout.x_item_view, null);
+            moreView.setText(sb.toString());
             views.add(moreView);
         }
 

+ 11 - 1
app/src/main/res/layout/x_item_view.xml

@@ -1,5 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 
+<!--
 <LinearLayout
 
     xmlns:android="http://schemas.android.com/apk/res/android"
@@ -16,4 +17,13 @@
         android:layout_margin="5dp"
         android:layout_centerVertical="true"
         />
-</LinearLayout>
+</LinearLayout>-->
+<TextView
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:text="内容"
+    style="@style/txt_style_12"
+    android:padding="5dp"
+    android:gravity="center_vertical"
+    />