android – 当布局可见性设置为GONE时,无法看到布局外的我的微调器

android – 当布局可见性设置为GONE时,无法看到布局外的我的微调器,第1张

概述在我的 XML中,我有一个’Select Operator’微调器,然后是一个线性布局,其中包含一些Edit文本和一个’Select Region’微调器. 在布局下面,我有一个编辑文本和一个按钮. 在按钮上单击偶数我将布局的可见性设置为GONE或VISIBLE. 当我将可见性设置为GONE时,我可以看到’Select Operator’微调器,但是当我将可见性设置为VISIBLE时,我看不到我的 在我的 XML中,我有一个’Select Operator’微调器,然后是一个线性布局,其中包含一些Edit文本和一个’Select Region’微调器.

在布局下面,我有一个编辑文本和一个按钮.
在按钮上单击偶数我将布局的可见性设置为GONE或VISIBLE.

当我将可见性设置为GONE时,我可以看到’Select Operator’微调器,但是当我将可见性设置为VISIBLE时,我看不到我的微调器.我不知道为什么会这样.

谁能告诉我问题的确切位置.

我的XML:

<?xml version="1.0" enCoding="utf-8"?><FrameLayout xmlns:androID="http://schemas.androID.com/apk/res/androID"    androID:layout_wIDth="match_parent"    androID:layout_height="match_parent"    androID:fillVIEwport="true">    <ScrollVIEw        androID:layout_height="match_parent"        androID:layout_wIDth="match_parent"        androID:fillVIEwport="true">    <linearLayout        androID:layout_wIDth="fill_parent"        androID:layout_height="match_parent"        androID:orIEntation="vertical"        androID:layout_gravity="center">        <Spinner            androID:ID="@+ID/splayout_electricity_OPERATORsp"            androID:layout_wIDth="match_parent"            androID:layout_height="40dp"            androID:textSize="10dp"            androID:layout_margintop="40dp"            androID:layout_marginleft="20dp"            androID:layout_marginRight="20dp"            androID:entrIEs="@array/operators_electricity"/>        <linearLayout            androID:layout_height="wrap_content"            androID:layout_wIDth="match_parent"            androID:orIEntation="vertical"            androID:layout_margintop="20dp"            androID:ID="@+ID/llayout_electricity_TNEBLAYOUTl"            androID:visibility="visible">            <Spinner                androID:ID="@+ID/splayout_electricity_TNEBREGIONsp"                androID:layout_wIDth="match_parent"                androID:layout_height="40dp"                androID:textSize="10dp"                androID:layout_marginleft="20dp"                androID:layout_marginRight="20dp"                androID:gravity="left"                androID:entrIEs="@array/operators_electricity_REGION"/>            <EditText                androID:layout_wIDth="match_parent"                androID:layout_height="40dp"                androID:textSize="15dp"                androID:layout_margintop="20dp"                androID:hint="Code"                androID:gravity="left"                androID:layout_marginleft="20dp"                androID:layout_marginRight="20dp"                androID:ID="@+ID/elayout_electricity_TNEBCODEet" />            <EditText                androID:layout_wIDth="match_parent"                androID:layout_height="40dp"                androID:textSize="15dp"                androID:layout_margintop="20dp"                androID:hint="Consumer name"                androID:gravity="left"                androID:layout_marginleft="20dp"                androID:inputType="textPersonname"                androID:layout_marginRight="20dp"                androID:ID="@+ID/elayout_electricity_TNEBCONSUMERnameet" />            <EditText                androID:layout_wIDth="match_parent"                androID:layout_height="40dp"                androID:textSize="15dp"                androID:layout_margintop="20dp"                androID:hint="Contact Number"                androID:inputType="numberDecimal"                androID:gravity="left"                androID:layout_marginleft="20dp"                androID:layout_marginRight="20dp"                androID:ID="@+ID/elayout_electricity_TNEBCONTACTNOet" />        </linearLayout>        <EditText            androID:layout_wIDth="match_parent"            androID:layout_height="40dp"            androID:textSize="15dp"            androID:layout_margintop="20dp"            androID:hint="Consumer Number (Refer Bill)"            androID:gravity="left"            androID:layout_marginleft="20dp"            androID:layout_marginRight="20dp"            androID:ID="@+ID/elayout_electricity_CONSUMERNOet" />        <EditText            androID:layout_wIDth="match_parent"            androID:layout_height="40dp"            androID:textSize="15dp"            androID:layout_margintop="20dp"            androID:hint="Amount"            androID:gravity="left"            androID:inputType="numberDecimal"            androID:layout_marginleft="20dp"            androID:layout_marginRight="20dp"            androID:ID="@+ID/elayout_electricity_AMOUNTet" />        <button            androID:ID="@+ID/blayout_electricity_RECHARGEbt"            androID:layout_wIDth="fill_parent"            androID:layout_height="40dp"            androID:layout_margintop="30dp"            androID:layout_marginleft="30dp"            androID:layout_marginRight="30dp"            androID:background="#16562e2e"            androID:textStyle="bold"            androID:text="Pay Bill"            androID:textcolor="#000000"            androID:textSize="15dp"/>    </linearLayout>    </ScrollVIEw></FrameLayout>My Java file:    l_TNEB = (linearLayout) getActivity().findVIEwByID(R.ID.llayout_electricity_TNEBLAYOUTl);        b_paybill = (button) getActivity().findVIEwByID(R.ID.blayout_electricity_RECHARGEbt);        b_paybill.setonClickListener(new VIEw.OnClickListener() {            @OverrIDe            public voID onClick(VIEw v) {                if(l_TNEB.getVisibility()== VIEw.VISIBLE)                {                    l_TNEB.setVisibility(VIEw.GONE);                }else {                    l_TNEB.setVisibility(VIEw.VISIBLE);                }            }        });

解决方法 将layout_height更改为wrap_content

<ScrollVIEw        androID:layout_height="match_parent"        androID:layout_wIDth="match_parent"        androID:fillVIEwport="true">    <linearLayout        androID:layout_wIDth="fill_parent"        androID:layout_height="wrap_content"        androID:orIEntation="vertical"        androID:layout_gravity="center">
总结

以上是内存溢出为你收集整理的android – 当布局可见性设置为GONE时,无法看到布局外的我的微调器全部内容,希望文章能够帮你解决android – 当布局可见性设置为GONE时,无法看到布局外的我的微调器所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://www.54852.com/web/1125651.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-30
下一篇2022-05-30

发表评论

登录后才能评论

评论列表(0条)

    保存