【发布时间】:2013-03-22 20:07:45
【问题描述】:
我的布局有问题。在我的活动中,我首先显示一个启动屏幕,然后根据某些条件我需要显示不同的布局。当我显示一个布局时,它看起来像透明的白色(如启动视图),而另一个则可以,因为它的背景颜色匹配用它。 当我按下透明白色视图(文本视图)时,它看起来很正常。也就是说,它在按下和释放不同视图时充当按钮。
我尝试提供背景颜色,但仍然存在问题。不幸的是,我只需要为该视图提供白色。
谁能帮我更改新布局中显示的透明白色
这是有背景问题的视图布局
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="@color/white"
>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<TextView
android:id="@+id/abc"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
</RelativeLayout>
</ScrollView>
<RelativeLayout
android:id="@+id/button_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:paddingBottom="5dp"
>
<Button
android:id="@+id/btn1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:text="@string/btn1"
android:background="@drawable/btn1"
/>
<Button
android:id="@+id/btn2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:text="@string/btn2"
android:background="@drawable/btn2"
/>
</RelativeLayout>
在代码中
oncreate(){
setcontentview(splashscreen)
setview()
}
void setview(){
if(condition1){
setContentView(R.layout.a1);
}
else{
setContentView(R.layout.a2);
}
}
【问题讨论】:
-
你完成你的启动画面活动了吗?
-
您是否使其他视图无效?为什么不将其他视图设置为不可见,而将您正在使用的视图设置为可见。在这个问题上需要更多的肉。
-
@JibranKhan 在主要活动飞溅中使用 .我需要更改同一活动中的视图而不是新的视图
-
@digiholic 如何使视图无效?
-
Korcholis 的回答大致也是我做初始屏幕的方式。 Sjk,对不起,当我最初发布代码时,代码没有启动。也许您可以根据它的视图类型设置您的 splashscreen.setVisibility(View.INVISIBLE) 。我的意思是,也许屏幕并没有移除旧视图,只是在它上面绘制。
标签: android layout splash-screen