How To Solve Editext in More Numbers in a Layout And Get Values From That?

后端 未结 3 1168
名媛妹妹
名媛妹妹 2021-01-22 17:17

See this picture:

I am designing a sudoku in android, have done the layout like this, so 81 Editext is there. I

3条回答
  •  一整个雨季
    2021-01-22 18:10

    You can try out this way:

    public static ArrayList m_arr_edit= = new ArrayList();
      RelativeLayout p_rl_layout=new RelativeLayout(m_context);
      RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
      LinearLayout  m_ll_timelayout = new LinearLayout(m_context);
      m_ll_timelayout.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
        for (int i = 0; i < p_intervals; i++)
        {
            EditText m_edit = new EditText(m_context);
            m_edit.setLayoutParams(new LinearLayout.LayoutParams(90, LayoutParams.WRAP_CONTENT));
            m_edit.setText("Set Text");
            m_edit.setId(i);
            m_arr_edit.add(m_btn);
            m_ll_timelayout.addView(m_btn); 
        }
        layoutParams.addRule(RelativeLayout.BELOW);
        p_rl_layout.addView(m_ll_timelayout, layoutParams);
    

    I hope it will help you.

提交回复
热议问题