午夜剧场伦理_日本一道高清_国产又黄又硬_91黄色网战_女同久久另类69精品国产_妹妹的朋友在线

您的位置:首頁技術文章
文章詳情頁

java - LinearLayout設置background不顯示所設置的圖片

瀏覽:184日期:2023-11-19 17:17:56

問題描述

xml

<?xml version='1.0' encoding='utf-8'?><LinearLayout 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' > <FrameLayoutandroid: android:layout_width='match_parent'android:layout_height='match_parent'/></LinearLayout>

xml=====>fragment_login_replace

<?xml version='1.0' encoding='utf-8'?><LinearLayout 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'> <RelativeLayoutandroid:layout_width='match_parent'android:layout_height='100dp'android:orientation='vertical'android:layout_weight='0.29'><ImageView android: android:layout_width='50dp' android:layout_height='50dp' android:src='http://www.leifengta.com.cn/wenda/@drawable/logo_red' android:layout_centerVertical='true' android:layout_alignLeft='@+id/textView' android:layout_alignStart='@+id/textView' /><TextView android: 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' /> </RelativeLayout> <android.support.design.widget.TextInputLayoutandroid:layout_marginLeft='25dp'android:layout_marginRight='20dp'android:layout_marginTop='35dp'android: android:layout_width='match_parent'android:layout_height='wrap_content'><EditText android: android:layout_width='match_parent' android:layout_height='match_parent' android:hint='用戶名' /> </android.support.design.widget.TextInputLayout> <android.support.design.widget.TextInputLayoutandroid:layout_marginLeft='25dp'android:layout_marginRight='20dp'android: android:layout_width='match_parent'android:layout_height='wrap_content'><EditText android: android:layout_width='match_parent' android:layout_height='match_parent' android:hint='密碼' /> </android.support.design.widget.TextInputLayout> <Buttonandroid: 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' /> <TextViewandroid: 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' /></LinearLayout>

Activity

public void init(LoginFragment fragment){FragmentTransaction transaction = activity.getSupportFragmentManager().beginTransaction();transaction.replace(R.id.fragment_login_replace, fragment, 'login');transaction.commit(); }

背景顯示為白色 很是糾結

問題解答

回答1:

我是有 三個文件夾 一個drawable drawable-v21 drawable-xxhdpi之前放在了drawable內 背景圖片被 94kb的jpg 格式然后 放在drawable-xxhdpi 下 就可以成功顯示了

有沒有知道原因的

回答2:

看了好幾遍沒發現什么端倪,而且拷到我的AS里面也沒發現大問題,也只發現有屬性使用不當:

android:textSize='30dp'//字號建議用spandroid:layout_below='@id/button_login'//LinearLayout里面沒有layout_below

個人懷疑可能是非布局因素造成的,因此有兩個問題想確認下:1、@drawable/background_login,是個什么資源,png之類的圖片還是xml文件?2、style.xml里面對theme的定義是怎樣的?

回答3:

fragment使用肯定會用自己的根布局的圖片,你把背景寫到fragment_login_replace.xml這個文件不就好了

標簽: java
相關文章:
主站蜘蛛池模板: 久久天天干 | 免费网站看av | 亚洲一区av在线 | 亚洲免费高清 | 色av综合| 亚洲日本中文字幕在线 | 日本在线播放视频 | 亚洲成人国产精品 | 毛片在线网站 | 亚洲色图日本 | 国产a级黄色片 | 午夜激情婷婷 | 国产精品成人一区 | 欧美性猛交xxxx乱 | 亚洲成人一级 | 99riav1国产精品视频 | 国产精品亚洲色图 | 久久久久久久久久免费视频 | 五月婷婷丁香在线 | 亚洲午夜久久久 | 日韩欧美成人一区二区三区 | 69xxx免费 | 成人激情在线视频 | 亚洲色图片区 | 男人天堂社区 | 亚洲一区中文字幕 | av片国产 | 亚洲女人天堂网 | www.婷婷| 欧美日韩高清一区二区 | 毛片大全免费看 | 综合精品在线 | 久久精品在线免费视频 | 久久久久久久网站 | a级片在线观看视频 | 亚洲欧美另类视频 | 中文一区二区 | 欧美色成人 | 色综合免费视频 | 久久精品麻豆 | 成人午夜在线播放 |