Android编辑文本错误与Actionbar重叠

时间:2017-04-17 13:07:55

标签: java android xml

有人知道如何在操作栏后面显示错误消息吗?

enter image description here

请检查这是我的xml设计文件:

<div class="modal fade" id="myModal" role="dialog">
    <div class="modal-dialog">

        <!-- Modal content-->
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">&times;</button>
                <h4 class="modal-title">Tell Us What's Going On ?</h4>
            </div>
            <form method="post" action="reportPost" data-ajax="1">
                <div class="modal-body">

                    <label><input type="radio" name="optradio" value="1">&nbsp;&nbsp;it's not interesting</label><br>
                    <label><input type="radio" name="optradio" value="2">&nbsp;&nbsp;I think it should not in our website</label><br>
                    <label><input type="radio" name="optradio" value="3">&nbsp;&nbsp;it's a spam</label><br>

                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                    <button type="submit" id="report_post" class="btn btn-primary" data-dismiss="modal">Save</button>
                </div>
            </form>
        </div>

    </div>
</div>

3 个答案:

答案 0 :(得分:1)

我得到了这个问题的解决方案,请试试这个

scrollView.setOnTouchListener(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            if (yourEditText.getError() != null) {
                yourEditText.setError(null);
                return true;
            }
            return false;
        }
    });

答案 1 :(得分:0)

我认为您正在对所有编辑文本进行一次验证(在if块中使用||)逐个进行验证(使用&amp;&amp;而不是||)这将自动将您的姓氏代码集中在操作栏下方有错误信息。

答案 2 :(得分:0)

如果您使用LinearLayout作为主要父级布局,请将其更改为Vertical并将方向设置为<meta property="og:url" content="Your current page's url" /> <meta property="og:type" content="content type" /> <meta property="og:title" content="Title of your page or title you want to show in facebook" /> <meta property="og:description" content="Short description what your webpage is about" /> <meta property="og:image" content="url of your image to be shown in facebook" />