背景图片 android xamarin
Background image android xamarin
我试图为 android 中的主要 activity 设置背景图片(使用 xamarin)。该图像显示在设计中,但当我模拟我的 phone (Galaxy S4) 时未显示。这是代码。这里有什么问题?
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="@drawable/home"
android:scaleType="fitXY" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<GridLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:columnCount="1"
android:layout_gravity="bottom"
android:minHeight="250dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:minHeight="125dp">
<Space
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button 1"
android:layout_gravity="center" />
<Space
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Button 2" />
<Space
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:minHeight="125dp">
<Space
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button 3"
android:layout_gravity="center" />
<Space
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Button 4" />
<Space
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1" />
</LinearLayout>
</GridLayout>
</LinearLayout>
</RelativeLayout>
它可能太大了。在控制台中显示如下错误:Bitmap too large to be uploaded into a texture (4350x2448, max=4096x4096)
尝试把图片放到drawable-nodpi
Android background image memory usage
我试图为 android 中的主要 activity 设置背景图片(使用 xamarin)。该图像显示在设计中,但当我模拟我的 phone (Galaxy S4) 时未显示。这是代码。这里有什么问题?
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="@drawable/home"
android:scaleType="fitXY" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<GridLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:columnCount="1"
android:layout_gravity="bottom"
android:minHeight="250dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:minHeight="125dp">
<Space
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button 1"
android:layout_gravity="center" />
<Space
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Button 2" />
<Space
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:minHeight="125dp">
<Space
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button 3"
android:layout_gravity="center" />
<Space
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Button 4" />
<Space
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1" />
</LinearLayout>
</GridLayout>
</LinearLayout>
</RelativeLayout>
它可能太大了。在控制台中显示如下错误:Bitmap too large to be uploaded into a texture (4350x2448, max=4096x4096)
尝试把图片放到drawable-nodpi
Android background image memory usage