Java 如何在应用程序中添加行?安卓工作室

Java 如何在应用程序中添加行?安卓工作室,java,android,android-studio,if-statement,tablelayout,Java,Android,Android Studio,If Statement,Tablelayout,嗨,伙计们,我需要你们的帮助 我正在做一个购物应用程序 用户将输入条形码,程序将输入产品的名称和价格 但我不知道该怎么做。 我用了“桌面布局” 我加了14个“tableRow” 这是我的密码 code=findViewById(R.id.barcode); code.addTextChangedListener(enter); } private TextWatcher enter = new TextWatcher() { @Override

嗨,伙计们,我需要你们的帮助

我正在做一个购物应用程序 用户将输入条形码,程序将输入产品的名称和价格

但我不知道该怎么做。 我用了“桌面布局” 我加了14个“tableRow” 这是我的密码

code=findViewById(R.id.barcode);
code.addTextChangedListener(enter);
    }
    private TextWatcher enter = new TextWatcher() {
        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {

        }
        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {

            if(code.getText().toString().trim().equals("659245631")) {
                //what can i write here to add row like this
                // (coulmn0,coulmn1)
                // ( price ,  product name)
            }
        }
        @Override
        public void afterTextChanged(Editable s) {
            if(code.getText().toString().trim().equals("659245631"))
            {


            }

        }
    };

但是我不知道需要采取什么行动,您能帮我吗?

您可以将
表格行
替换为
列表视图
回收视图
,并根据您的条形码对其进行过滤

是一个关于如何创建ListView的简单示例


这是一个如何在listView中进行筛选的示例。

我确实需要帮助:(谢谢,我已将表行链接到RecycleView,但我无法设置相关条件。)你知道我如何做到这一点吗?我的想法是用RecycleView或listView完全替换表行