简体   繁体   English

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

[英]How can I add a row from within the application ? Android studio

hi guys i'm need your Help嗨,伙计们,我需要你们的帮助

I am doing a shopping app The user will enter the barcode and the program will enter the name and price of the product我正在做一个购物应用程序 用户将输入条形码,程序将输入产品的名称和价格

Here is a picture of the table这是一张桌子的照片

But I don't know exactly how to do that.但我不知道如何做到这一点。 I used the "TableLayout" And I added 14 "tableRow" and here is my code我使用了“TableLayout”并添加了 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"))
            {


            }

        }
    };

But I do not know what is the required action Can you help me?但我不知道需要什么操作你能帮我吗?

You can replace TableRow with ListView or RecycleView , and filter it based on your barcode.您可以将TableRow替换为ListViewRecycleView ,并根据您的条形码对其进行过滤。

Here is an simple example on how create a ListView 是一个关于如何创建 ListView 的简单示例

Here is an example on how filter in listView. 是一个关于如何在 listView 中过滤的示例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Android Studio QR码扫描仪Zxing。 如何在我的应用程序中打开QR码扫描的结果(URL链接)? - Android Studio QR Code Scanner Zxing. How can I open the Result of the QR Code scan (URL Link) within my Application? 如何添加我经常用于android studio的方法? - How can I add methods that I often use to android studio? 如何在Android Studio中进行自定义应用程序? - How can i do Customization application in Android studio? 如何从firebase中检索值并将值添加到其中并在android studio JAVA中更新到firebase - How can I retreive value from firebase and add value into it and update to firebase in android studio JAVA 如何将两个集合添加到 Firestore 的集合 android 工作室中 - How can I add two collection into collection android studio in firestore 如何在 android 工作室中向 CountDownTimer 添加变量? - How can I add variable to CountDownTimer in android studio? 如何将Listview添加到Listview Android Studio中 - How can i add Listview into Listview Android Studio 如何将此模块添加到我的Android Studio项目中? - How can I add this module to my Android Studio project? 如何使用 java 以编程方式添加数字选择器( android 工作室) - How can I add a number picker programmatically with java ( android studio ) 如何在菜单中添加按钮(在 Android Studio 中) - How can i add button in menu (In Android Studio)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM