android linearlayout 设置背景图片,LinearLayout设置background不显示所设置的图片

xml

xmlns:android="http://schemas.android.com/apk/res/android"

android:orientation="vertical"

android:layout_width="match_parent"

android:layout_height="match_parent"

android:background="@drawable/background_login"

>

android:id="@+id/fragment_login_replace"

android:layout_width="match_parent"

android:layout_height="match_parent"/>

xml=====>fragment_login_replace

xmlns:android="http://schemas.android.com/apk/res/android"

android:background="@drawable/background_login"

android:orientation="vertical"

android:layout_width="match_parent"

android:layout_height="match_parent"

android:weightSum="1">

android:layout_width="match_parent"

android:layout_height="100dp"

android:orientation="vertical"

android:layout_weight="0.29">

android:id="@+id/imageView"

android:layout_width="50dp"

android:layout_height="50dp"

android:src="@drawable/logo_red"

android:layout_centerVertical="true"

android:layout_alignLeft="@+id/textView"

android:layout_alignStart="@+id/textView" />

android:id="@+id/textView"

android:layout_width="219dp"

android:layout_height="wrap_content"

android:textSize="30dp"

android:text="Home Work"

android:textAllCaps="false"

android:textColor="#ffff"

android:textStyle="bold"

android:layout_marginLeft="31dp"

android:layout_marginStart="31dp"

android:layout_below="@+id/imageView"

android:layout_alignParentLeft="true"

android:layout_alignParentStart="true" />

android:layout_marginLeft="25dp"

android:layout_marginRight="20dp"

android:layout_marginTop="35dp"

android:id="@+id/textinput_login_username"

android:layout_width="match_parent"

android:layout_height="wrap_content">

android:id="@+id/edit_login_username"

android:layout_width="match_parent"

android:layout_height="match_parent"

android:hint="用户名" />

android:layout_marginLeft="25dp"

android:layout_marginRight="20dp"

android:id="@+id/textinput_login_password"

android:layout_width="match_parent"

android:layout_height="wrap_content">

android:id="@+id/edit_login_password"

android:layout_width="match_parent"

android:layout_height="match_parent"

android:hint="密码" />

android:id="@+id/button_login"

android:layout_width="287dp"

android:layout_height="wrap_content"

android:layout_marginLeft="43dp"

android:layout_marginRight="20dp"

android:layout_marginTop="40dp"

android:background="@color/colorPrimary"

android:text="登录"

android:textColor="@color/white" />

android:id="@+id/text_register"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:layout_below="@id/button_login"

android:layout_marginTop="10dp"

android:layout_weight="0.03"

android:gravity="center_horizontal"

android:text="没有账号?注册一个"

android:textColor="@color/colorPrimary"

android:textSize="15sp" />

Activity

public void init(LoginFragment fragment){

FragmentTransaction transaction = activity.getSupportFragmentManager().beginTransaction();

transaction.replace(R.id.fragment_login_replace, fragment, "login");

transaction.commit();

}

背景显示为白色 很是纠结

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值