为了账号安全,请及时绑定邮箱和手机立即绑定

各位大虾,紧急求助

各位大虾,紧急求助

andriod_2014 2015-01-05 11:15:30
申明了一个属性:private View mPassView;为什么我在handlePassEvent()方法中通过mPassView属性调用anser_right布局不会生效? private void handlePassEvent() { mPassView = (LinearLayout)this.findViewById(R.id.pass_view); mPassView.setVisibility(View.VISIBLE);这里的调用不会出现通关界面,其它是正常的,求解xml布局应该是没有错误的<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:id="@+id/pass_view"    android:layout_width="match_parent"    android:layout_height="match_parent"    android:background="#cc000000"    android:gravity="center"    android:orientation="vertical"     android:visibility="gone" >    <LinearLayout        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:gravity="center" >        <ImageView            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:layout_marginRight="5dp"            android:src="@drawable/index_medal" />        <TextView            android:id="@+id/text_main_achievement"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:text="您已击败"            android:textColor="@color/white"            android:textSize="18sp" />    </LinearLayout>    <TextView        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:layout_marginTop="40dp"        android:text="答案正确"        android:textColor="@color/white"        android:textSize="35sp" />    <FrameLayout        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:layout_marginBottom="40dp"        android:layout_marginTop="40dp" >        <ImageView            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:src="@drawable/game_level_title" />        <TextView            android:id="@+id/text_current_stage_pass"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:layout_gravity="center"            android:text="1"            android:textColor="@color/white"            android:textSize="20sp"            android:textStyle="bold" />    </FrameLayout>    <TextView        android:id="@+id/text_current_song_name_pass"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:layout_marginBottom="20dp"        android:text="同桌的你"        android:textColor="@color/white"        android:textSize="20sp" />    <LinearLayout        android:layout_width="match_parent"        android:layout_height="wrap_content"        android:layout_marginBottom="20dp"        android:gravity="center" >        <TextView            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:text="奖励:"            android:textColor="@color/white"            android:textSize="20sp" />        <ImageView            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:src="@drawable/game_coin_icon" />        <TextView            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:text="*"            android:textColor="@color/white"            android:textSize="25sp" />        <TextView            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:text="3"            android:textColor="@color/white"            android:textSize="25sp" />    </LinearLayout>    <ImageButton        android:id="@+id/btn_next"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:layout_marginBottom="20dp"        android:background="@drawable/next_button_icon" />    <ImageButton        android:id="@+id/btn_share"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:background="@drawable/weixin_button_icon" /></LinearLayout>
查看完整描述

2 回答

?
andriod_2014

TA贡献12条经验 获得超1个赞

已经解决,我在主界面中引用这个布局时,位置出现了错误,谢谢

查看完整回答
反对 回复 2015-01-05
?
溜达溜达

TA贡献106条经验 获得超19个赞

检查一下,在主界面中是否已经引用了这个布局

查看完整回答
反对 回复 2015-01-05
  • 2 回答
  • 0 关注
  • 1778 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信