如何将列表视图放入片段中

2024-03-20

如何将列表视图放入片段中?我使用带有固定选项卡的默认项目设置。

它似乎不起作用,我的应用程序崩溃了。

主要活动

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Locale;

import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;

import android.app.ActionBar;
import android.app.FragmentTransaction;
import android.app.ListActivity;
import android.app.ListFragment;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.StrictMode;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.Toast;

public class MainActivity extends FragmentActivity implements
        ActionBar.TabListener {
    /**
     * The {@link android.support.v4.view.PagerAdapter} that will provide
     * fragments for each of the sections. We use a
     * {@link android.support.v4.app.FragmentPagerAdapter} derivative, which
     * will keep every loaded fragment in memory. If this becomes too memory
     * intensive, it may be best to switch to a
     * {@link android.support.v4.app.FragmentStatePagerAdapter}.
     */

    /**
     * The {@link ViewPager} that will host the section contents.
     */
    ViewPager mViewPager;
    public final static String PREFS_NAME = "UserData";
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        //Only for safe mode 
        StrictMode.ThreadPolicy policy = new StrictMode.
        ThreadPolicy.Builder().permitAll().build();
        StrictMode.setThreadPolicy(policy);
        /***********************************USER***************************/
        //Get User info (if exist)
        SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0);
        String id = settings.getString("id", "");
        String pass = settings.getString("pass", "");
        SectionsPagerAdapter mSectionsPagerAdapter;
        //Else create New User
        if (id == "")
        {
            System.out.println("Create New User...");
            UserRegistration.CreateUser(getApplicationContext());
        }
        /**** OTHER*****/
        super.onCreate(savedInstanceState);


        setContentView(R.layout.activity_main);
        // Set up the action bar.
        final ActionBar actionBar = getActionBar();
        actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
        // Create the adapter that will return a fragment for each of the three
        // primary sections of the app.
        mSectionsPagerAdapter = new SectionsPagerAdapter(
                getSupportFragmentManager());

        // Set up the ViewPager with the sections adapter.
        mViewPager = (ViewPager) findViewById(R.id.pager);
        mViewPager.setAdapter(mSectionsPagerAdapter);
        // When swiping between different sections, select the corresponding
        // tab. We can also use ActionBar.Tab#select() to do this if we have
        // a reference to the Tab.
        mViewPager
                .setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
                    @Override
                    public void onPageSelected(int position) {
                        actionBar.setSelectedNavigationItem(position);
                    }
                });

        // For each of the sections in the app, add a tab to the action bar.
        for (int i = 0; i < mSectionsPagerAdapter.getCount(); i++) {
            // Create a tab with text corresponding to the page title defined by
            // the adapter. Also specify this Activity object, which implements
            // the TabListener interface, as the callback (listener) for when
            // this tab is selected.
            actionBar.addTab(actionBar.newTab()
                    .setText(mSectionsPagerAdapter.getPageTitle(i))
                    .setTabListener(this));
        }


    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }

    @Override
    public void onTabSelected(ActionBar.Tab tab,
            FragmentTransaction fragmentTransaction) {
        // When the given tab is selected, switch to the corresponding page in
        // the ViewPager.
        mViewPager.setCurrentItem(tab.getPosition());
    }

    @Override
    public void onTabUnselected(ActionBar.Tab tab,
            FragmentTransaction fragmentTransaction) {
    }

    @Override
    public void onTabReselected(ActionBar.Tab tab,
            FragmentTransaction fragmentTransaction) {
    }

    /**
     * A {@link FragmentPagerAdapter} that returns a fragment corresponding to
     * one of the sections/tabs/pages.
     */
    public class SectionsPagerAdapter extends FragmentPagerAdapter {

        public SectionsPagerAdapter(FragmentManager fm) {
            super(fm);
        }

        @Override
        public Fragment getItem(int position) {
            // getItem is called to instantiate the fragment for the given page.
            // Return a DummySectionFragment (defined as a static inner class
            // below) with the page number as its lone argument.
            Fragment fragment = new DummySectionFragment();
            Bundle args = new Bundle();
            args.putInt(DummySectionFragment.ARG_SECTION_NUMBER, position + 1);
            fragment.setArguments(args);
            return fragment;
        }

        @Override
        public int getCount() {
            // Show 5 total pages.
            return 5;
        }

        @Override
        public CharSequence getPageTitle(int position) {
            Locale l = Locale.getDefault();
            switch (position) {
            case 0:
                return getString(R.string.title_section1).toUpperCase(l);
            case 1:
                return getString(R.string.title_section2).toUpperCase(l);
            case 2:
                return getString(R.string.title_section3).toUpperCase(l);
            case 3:
                return getString(R.string.title_section4).toUpperCase(l);
            case 4:
                return getString(R.string.title_section5).toUpperCase(l);   
            }
            return null;
        }
    }

    /**
     * A dummy fragment representing a section of the app, but that simply
     * displays dummy text.
     */
    public static class DummySectionFragment extends Fragment {
        /**
         * The fragment argument representing the section number for this
         * fragment.
         */
        public static final String ARG_SECTION_NUMBER = "section_number";

        public DummySectionFragment() {
        }

        public View onCreateView(LayoutInflater inflater, ViewGroup container,
                Bundle savedInstanceState) {


            View rootView = inflater.inflate(R.layout.fragment_main_dummy, container, false);       
            /***********************************CONTEST INC**********************
            String xmlURL;
            ArrayList<HashMap<String, String>> mylist = new ArrayList<HashMap<String, String>>();
            xmlURL = URL;
            System.out.println("Case 1");
            Document doc = XMLfunctions.XMLfromString(XMLfunctions.getXML(xmlURL));
            NodeList nodes = doc.getElementsByTagName("contest");
            for (int i = 0; i < nodes.getLength(); i++) 
            {                           
                HashMap<String, String> map = new HashMap<String, String>();    

                Element e = (Element)nodes.item(i);
                map.put("id", XMLfunctions.getValue(e, "id"));
                map.put("name", XMLfunctions.getValue(e, "name"));
                map.put("subtitle",XMLfunctions.getValue(e, "subtitle"));
                mylist.add(map);
                System.out.println(mylist);
            }
            //new ArrayAdapter<String>(context, android.R.layout.simple_list_item_1, android.R.id.text1, actions);

            ListAdapter adapter = new SimpleAdapter(this.getActivity(), mylist , R.layout.contest_list, 
                    new String[] { "name", "subtitle" }, 
                    new int[] { R.id.item_title, R.id.item_subtitle });

            ListFragment.setListAdapter(adapter);

            final ListView lv = getApplication().getActivity().getListView();
            lv.setTextFilterEnabled(true);  
            lv.setOnItemClickListener(new OnItemClickListener() {
                public void onItemClick(AdapterView<?> parent, View view, int position, long id) {              
                    @SuppressWarnings("unchecked")
                    HashMap<String, String> o = (HashMap<String, String>) lv.getItemAtPosition(position);                   
                    Toast.makeText(this, "ID '" + o.get("id") + "' was clicked.", Toast.LENGTH_LONG).show(); 

                }
            });



            /*************************************END CONTEST*********************/
            ContestList.GetList(getActivity(), 1, "mm", "njk");

            //TextView dummyTextView = (TextView) rootView
                //  .findViewById(R.id.section_label);
            String sectionNumb = Integer.toString(getArguments().getInt(ARG_SECTION_NUMBER));
            int cat1;
            cat1 = Integer.parseInt(sectionNumb); 
            switch (cat1)
            {
            case 1:
                break;
            case 2:
                break;
            case 3:
                break;
            case 4:
                break;
            case 5:
                break;
            }   
            return rootView;
        }
    }
}

竞赛列表类

import java.util.ArrayList;
import java.util.HashMap;

import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;

import android.app.ListActivity;
import android.app.ListFragment;
import android.content.Context;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.Toast;

public class ContestList {
    public final static String PREFS_NAME = "UserData";

    public static String GetList(Context context, int type, String id, String pass)
    {

        String xmlURL;
        ArrayList<HashMap<String, String>> mylist = new ArrayList<HashMap<String, String>>();
        xmlURL = URL;
        System.out.println("Case 1");
        Document doc = XMLfunctions.XMLfromString(XMLfunctions.getXML(xmlURL));
        NodeList nodes = doc.getElementsByTagName("contest");
        for (int i = 0; i < nodes.getLength(); i++) 
        {                           
            HashMap<String, String> map = new HashMap<String, String>();    

            Element e = (Element)nodes.item(i);
            map.put("id", XMLfunctions.getValue(e, "id"));
            map.put("name", XMLfunctions.getValue(e, "name"));
            map.put("subtitle",XMLfunctions.getValue(e, "subtitle"));
            mylist.add(map);
            System.out.println(mylist);
        }
        //new ArrayAdapter<String>(context, android.R.layout.simple_list_item_1, android.R.id.text1, actions);

        ListAdapter adapter = new SimpleAdapter(context, mylist , R.layout.contest_list, 
                new String[] { "name", "subtitle" }, 
                new int[] { R.id.item_title, R.id.item_subtitle });

        ((ListActivity) context).setListAdapter(adapter);

        final ListView lv = ((ListActivity) context).getListView();
        lv.setTextFilterEnabled(true);  
        lv.setOnItemClickListener(new OnItemClickListener() {
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {              
                @SuppressWarnings("unchecked")
                HashMap<String, String> o = (HashMap<String, String>) lv.getItemAtPosition(position);                   
                //Toast.makeText(Main.this, "ID '" + o.get("id") + "' was clicked.", Toast.LENGTH_LONG).show(); 

            }
        });
        return "OK";
    }   
    public String adapter(ListAdapter adapter)
    {/*
        setListAdapter(adapter);

        final ListView lv = getApplication().getActivity().getListView();
        lv.setTextFilterEnabled(true);  
        lv.setOnItemClickListener(new OnItemClickListener() {
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {              
                @SuppressWarnings("unchecked")
                HashMap<String, String> o = (HashMap<String, String>) lv.getItemAtPosition(position);                   
                Toast.makeText(MainActivity.this, "ID '" + o.get("id") + "' was clicked.", Toast.LENGTH_LONG).show(); 

            }
        });*/
        return "OK";
    }
}

活动主布局:

    <android.support.v4.view.ViewPager xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/pager"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity" />

Fragment_main_dummy布局:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">    

<ListView
    android:id="@id/android:list"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:drawSelectorOnTop="false" />

<TextView
    android:id="@id/android:empty"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="No data"/>

<TextView  
android:id="@+id/item_title"
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
android:textAppearance="?android:attr/textAppearanceMedium"
android:padding="2dp"
android:textSize="20dp" />
<TextView  
android:id="@+id/item_subtitle"
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
android:padding="2dp"
android:textSize="13dp" />

有人知道为什么我的应用程序崩溃吗?或者有其他方法可以将列表视图放入片段中?

Thanks

EDIT:

错误日志

03-20 12:53:31.219: E/AndroidRuntime(3104): FATAL EXCEPTION: main
03-20 12:53:31.219: E/AndroidRuntime(3104): java.lang.ClassCastException: com.time2win.MainActivity cannot be cast to android.app.ListActivity
03-20 12:53:31.219: E/AndroidRuntime(3104):     at com.time2win.ContestList.GetList(ContestList.java:50)
03-20 12:53:31.219: E/AndroidRuntime(3104):     at com.time2win.MainActivity$DummySectionFragment.onCreateView(MainActivity.java:241)
03-20 12:53:31.219: E/AndroidRuntime(3104):     at android.support.v4.app.Fragment.performCreateView(Fragment.java:1460)
03-20 12:53:31.219: E/AndroidRuntime(3104):     at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:911)
03-20 12:53:31.219: E/AndroidRuntime(3104):     at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1088)
03-20 12:53:31.219: E/AndroidRuntime(3104):     at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
03-20 12:53:31.219: E/AndroidRuntime(3104):     at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1444)
03-20 12:53:31.219: E/AndroidRuntime(3104):     at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:461)
03-20 12:53:31.219: E/AndroidRuntime(3104):     at android.support.v4.app.FragmentPagerAdapter.finishUpdate(FragmentPagerAdapter.java:141)
03-20 12:53:31.219: E/AndroidRuntime(3104):     at android.support.v4.view.ViewPager.populate(ViewPager.java:1012)
03-20 12:53:31.219: E/AndroidRuntime(3104):     at android.support.v4.view.ViewPager.populate(ViewPager.java:881)
03-20 12:53:31.219: E/AndroidRuntime(3104):     at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1366)
03-20 12:53:31.219: E/AndroidRuntime(3104):     at android.view.View.measure(View.java:15513)
03-20 12:53:31.219: E/AndroidRuntime(3104):     at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4827)
03-20 12:53:31.219: E/AndroidRuntime(3104):     at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
03-20 12:53:31.219: E/AndroidRuntime(3104):     at android.view.View.measure(View.java:15513)
03-20 12:53:31.219: E/AndroidRuntime(3104):     at android.widget.LinearLayout.measureVertical(LinearLayout.java:847)
03-20 12:53:31.219: E/AndroidRuntime(3104):     at android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
03-20 12:53:31.219: E/AndroidRuntime(3104):     at android.view.View.measure(View.java:15513)
03-20 12:53:31.219: E/AndroidRuntime(3104):     at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4827)
03-20 12:53:31.219: E/AndroidRuntime(3104):     at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
03-20 12:53:31.219: E/AndroidRuntime(3104):     at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2176)
03-20 12:53:31.219: E/AndroidRuntime(3104):     at android.view.View.measure(View.java:15513)
03-20 12:53:31.219: E/AndroidRuntime(3104):     at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:1874)
03-20 12:53:31.219: E/AndroidRuntime(3104):     at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1089)
03-20 12:53:31.219: E/AndroidRuntime(3104):     at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1265)
03-20 12:53:31.219: E/AndroidRuntime(3104):     at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:989)
03-20 12:53:31.219: E/AndroidRuntime(3104):     at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4351)
03-20 12:53:31.219: E/AndroidRuntime(3104):     at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
03-20 12:53:31.219: E/AndroidRuntime(3104):     at android.view.Choreographer.doCallbacks(Choreographer.java:562)
03-20 12:53:31.219: E/AndroidRuntime(3104):     at android.view.Choreographer.doFrame(Choreographer.java:532)
03-20 12:53:31.219: E/AndroidRuntime(3104):     at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735)
03-20 12:53:31.219: E/AndroidRuntime(3104):     at android.os.Handler.handleCallback(Handler.java:725)
03-20 12:53:31.219: E/AndroidRuntime(3104):     at android.os.Handler.dispatchMessage(Handler.java:92)
03-20 12:53:31.219: E/AndroidRuntime(3104):     at android.os.Looper.loop(Looper.java:137)
03-20 12:53:31.219: E/AndroidRuntime(3104):     at android.app.ActivityThread.main(ActivityThread.java:5039)
03-20 12:53:31.219: E/AndroidRuntime(3104):     at java.lang.reflect.Method.invokeNative(Native Method)
03-20 12:53:31.219: E/AndroidRuntime(3104):     at java.lang.reflect.Method.invoke(Method.java:511)
03-20 12:53:31.219: E/AndroidRuntime(3104):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
03-20 12:53:31.219: E/AndroidRuntime(3104):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
03-20 12:53:31.219: E/AndroidRuntime(3104):     at dalvik.system.NativeStart.main(Native Method)

你可以使用 ListFragment 来实现这一点。文档中对此进行了很好的解释:

http://developer.android.com/reference/android/app/ListFragment.html http://developer.android.com/reference/android/app/ListFragment.html

Vogela 也有这方面的教程:

http://www.vogella.com/articles/AndroidListView/article.html#listfragments http://www.vogella.com/articles/AndroidListView/article.html#listfragments

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何将列表视图放入片段中 的相关文章

随机推荐

  • Firestore存储大小限制如何存储大型数组

    我有一个收藏users userID followers该用户 ID 是 firebase UID 因此长度为 29 个字节 字符串大小的计算方式为 UTF 8 编码字节数 1 在每个用户文档中 我都有一个名为 follower 的数组和另
  • 解析 DateFormat 时的 Java 时区

    我的代码解析日期如下 String ALT DATE TIME FORMAT yyyy MM dd T HH mm ss SSSZ SimpleDateFormat sdf new SimpleDateFormat ALT DATE TIM
  • android AppWidget 未添加到 Lollipop 上的主屏幕

    我开发了一个应用程序 可以在主屏幕小部件上显示新闻源 由于以下情况 在 Lollipop 之前的 Android 设备上一切正常 用户进入启动器的小部件屏幕以选择 添加特定的小部件 用户单击 MyNewsWidget 以添加到其主屏幕 调用
  • 让 div 占据另一个 div 后剩余的所有空间

    我有两个并排的 div 第一个包含一个可能相当长的文本字段 另一个包含一个很短的数字 我需要第一个 div 占据所有可用空间 而无需拉伸父级并在必要时进行剪切 Ant 它应该考虑第二个 div 的宽度 因此 如果文本的长度很短 那么两个 d
  • linuxrc 的用途是什么以及 rootfs 中是否需要它?

    Question 我的问题是 什么是linuxrc做 我需要它吗 rootfs 和使用有什么关系吗systemd vs initd 背景 我目前正在尝试建立一个rootfs适用于使用 Yocto 的 ARM 7 处理器 我对原始 BSP 项
  • docx4j - 删除 wml P 元素

    我正在使用 docx4j 来处理 Microsoft Word 模板 我想知道如何删除或隐藏模板中的 P 元素 我能够遍历代码来获取特定的 P 元素 现在我需要知道如何删除或隐藏该 P 元素 有人可以帮忙吗 我使用以下代码获取所有 P 元素
  • 按 Enter 键提交搜索?

    当有人按下 回车 键时 需要做什么才能提交此表单
  • Visual Studio 弹出窗口:“操作无法完成”

    当我尝试打开一个项目时 无论是本地项目还是在团队基础服务器 https en wikipedia org wiki Team Foundation Server TFS 我得到一个模态窗口告诉我 操作无法完成 未指定的错误 或者相同的消息
  • 内存怎么这么大?

    我有一个 1000x1500 像素位图 我想在 Android 中制作一个可变副本 当我运行以下代码时 int width original getWidth 1000px int height original getHeight 150
  • C++中的restrict关键字是什么意思?

    我总是不确定 restrict关键字在C 中意味着什么 这是否意味着赋予函数的两个或多个指针不重叠 还有什么意思呢 在他的论文中 内存优化 https web archive org web 20160422113037 http www
  • 如何在 sunos 中获取附加到特定端口的进程 ID

    我正在尝试在 SunOS 上使用端口 7085 连接进程 我尝试执行以下命令 netstat ntlp grep 7085没有返回任何东西 netstat anop grep 7085也尝试过这个 此开关在 SunOs 中无效 我得到以下输
  • numpy:有效地添加矩阵的行

    我有一个矩阵 mat array 0 1 2 3 4 5 6 7 8 9 10 11 我想获得某些索引处的行的总和 例如 ixs np array 0 2 0 0 0 1 1 我知道我可以将答案计算为 mat ixs sum axis 0
  • 如何在不使用登录系统的情况下识别唯一用户(iOS)

    我需要一种方法来识别我的应用程序的用户 但没有登录系统 我研究了 UUID 它为我的问题提供了部分答案 但由于它不是真正的 UDID 因此它不是 真正唯一的 如果用户重新安装应用程序 他会获得一个新的 UUID 这可以 不为我工作 有什么方
  • 如何使用flex4使用前置摄像头

    我使用 Flex 4 为 Android 移动设备开发了简单的相机应用程序 问题是 当我运行该应用程序时 它使用后置摄像头 它没有使用前置摄像头 怎么换相机啊 我需要使用前置摄像头来实现此应用程序 请帮助我 var camera Camer
  • 不是动态选择字段 WTFORMS 的有效选择

    我目前正在使用 WTFORMS 创建动态选择字段 但是它从未提交并且验证失败并出现以下错误 Not a valid choice 我的字段是这样创建的 area SelectField 在视图中 我从数据库中获取选项 如下所示 form M
  • 外部元素边距不等于内部元素边距

    我正在使用 Android WebView 来显示我的应用程序的 HTML 内容 我需要动态查找元素 通常是 div 的完整高度 包括填充 边距和边框 我正在使用 JavaScript 无法使用 jQuery 我一直在使用scrollHei
  • 如何在多租户数据库中设置唯一约束

    这是一个多租户应用程序 所有记录都有一个客户 ID 来分隔客户数据 客户可以在此表中插入自己的数据并设置自己的唯一约束 每个客户都可以对 15 个字段中的任何一个字段设置唯一约束 也可以不设置任何约束 因此 在实际表上设置唯一约束是行不通的
  • 如何在装饰器中获取 Flask 可选 URL 参数?

    我的 Flask API 都使用电话作为可选的 url 参数 如下所示 我想使用装饰器来验证电话号码是否正确 那么我可以在不解析请求url的情况下在某处获取参数 phone 吗 user api route
  • 在更改视图网格 fullcalendar v4 上拖放后,带有 rrule 插件的事件不会更新

    我目前正在使用 rrule 插件开发 Fullcalendar v4 我有这个代码 var calendarEl document getElementById calendardemo var calendar new FullCalen
  • 如何将列表视图放入片段中

    如何将列表视图放入片段中 我使用带有固定选项卡的默认项目设置 它似乎不起作用 我的应用程序崩溃了 主要活动 import java util ArrayList import java util HashMap import java ut