Browse Source

产蛋期

master
lh 7 years ago
parent
commit
25761b8449
2 changed files with 63 additions and 7 deletions
  1. +46
    -0
      app/src/main/java/com/qhclh/ytzh/work/Poultrydailyreport/ChandanFragment.java
  2. +17
    -7
      app/src/main/res/layout/frag_chandan.xml

+ 46
- 0
app/src/main/java/com/qhclh/ytzh/work/Poultrydailyreport/ChandanFragment.java View File

@ -1,13 +1,22 @@
package com.qhclh.ytzh.work.Poultrydailyreport;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.qhclh.ytzh.R;
import com.qhclh.ytzh.base.BaseFragment;
import butterknife.BindView;
/**
* Created by 青花瓷 on 2018/3/22.
*/
public class ChandanFragment extends BaseFragment {
@BindView(R.id.firstContent_chandan)
LinearLayout firstContent;
@Override
protected int setLayout() {
return R.layout.frag_chandan;
@ -20,7 +29,44 @@ public class ChandanFragment extends BaseFragment {
@Override
protected void initData() {
firstContent.removeAllViews();
for (int i=1;i<13;i++){
View view = LayoutInflater.from(getActivity()).inflate(R.layout.view_first,null);
TextView name = view.findViewById(R.id.name);
LinearLayout secondContent = view.findViewById(R.id.secondContent);
LinearLayout main_ll = view.findViewById(R.id.main_ll);
name.setText("场:"+i);
main_ll.setTag(i);
secondContent.removeAllViews();
for (int j=0;j<i+1;j++){
View view2 = LayoutInflater.from(getActivity()).inflate(R.layout.view_second,null);
TextView item1 = view2.findViewById(R.id.item1);
TextView item2 = view2.findViewById(R.id.item2);
TextView item3 = view2.findViewById(R.id.item3);
TextView item4 = view2.findViewById(R.id.item4);
item1.setText("item1:"+i+1);
item2.setText("item2:"+i+2);
item3.setText("item3:"+i+3);
item4.setText("item4:"+i+4);
secondContent.addView(view2);
}
firstContent.addView(view);
main_ll.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
System.out.println("aaa++++++tag+++"+view.getTag());
if ((int)view.getTag()==1){
System.out.println("aaa+++++tttt+++"+view.getTag());
}
}
});
}
}
@Override


+ 17
- 7
app/src/main/res/layout/frag_chandan.xml View File

@ -1,11 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:text="产蛋期"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:id="@+id/firstContent_chandan"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
</LinearLayout>
</LinearLayout>
</LinearLayout>
</ScrollView>

Loading…
Cancel
Save