Android 自定义按钮可以';不能在片段中显示
第一次进入fragmentA时,按钮显示正常 然后,我用fragmentB代替fragmentA 然后,我让fragmentA再次替换fragmentB,按钮在fragmentA中消失 我遇到了什么问题 我的自定义按钮代码: 我的XML: ```Android 自定义按钮可以';不能在片段中显示,android,fragment,android-custom-view,Android,Fragment,Android Custom View,第一次进入fragmentA时,按钮显示正常 然后,我用fragmentB代替fragmentA 然后,我让fragmentA再次替换fragmentB,按钮在fragmentA中消失 我遇到了什么问题 我的自定义按钮代码: 我的XML: ``` ``` 谢谢。请给我们您的单键监听器。请将代码放在这里:该代码没有显示您上面描述的问题。只需要关于自定义按钮的代码,我想这是你的问题…自定义按钮的代码在这里:有我错过的覆盖方法吗?或者我不应该做的事?我发现了问题所在。我使用“this.setBac
```
谢谢。请给我们您的单键监听器。请将代码放在这里:该代码没有显示您上面描述的问题。只需要关于自定义按钮的代码,我想这是你的问题…自定义按钮的代码在这里:有我错过的覆盖方法吗?或者我不应该做的事?我发现了问题所在。我使用“this.setBackgroundResource(0)”删除按钮的背景,使按钮无法正常显示。但我还是不知道该把巴特顿的背景去掉。不管怎样,谢谢你的帮助。
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="cn.zmn.nizaoma.FragmentNizaoma">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<cn.zmn.widget.RaisedButton
android:id="@+id/question_one_but"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:text="问题1"/>
<cn.zmn.widget.RaisedButton
android:id="@+id/question_two_but"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:text="问题2"/>
</LinearLayout>
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/nizaoma_refesh_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.view.ViewPager
android:id="@+id/viewpager_nizaoma"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</android.support.v4.widget.SwipeRefreshLayout>
</LinearLayout>
</FrameLayout>