mor*_*org 6 android image screen image-size
我觉得用Android处理图像真的很难,我认为这是Android开发中最困难的部分......
1)我有一个图像,我希望它是我的应用程序的背景,所以我这样做
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
tools:context=".MainActivity"
android:background="@drawable/accueil">
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
背景应该填满整个屏幕,但它不是cas.某些(小)屏幕上仅显示部分背景.我怎么能说:我希望图像能够填满所有的屏幕,即使图像比图像大,屏幕上的图像应该减少,所以我看到了所有的背景?
也许我应该把我的背景放在背景上而不是用它作为背景
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
tools:context=".MainActivity">
<ImageView
android:id="@+id/imageView1"
android:layout_width="500dp"
android:layout_height="500dp"
android:adjustViewBounds="false"
android:src="@drawable/accueil" />
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
然而在某些设备中,图像有点裁剪.
2)我必须在另一个布局中放置一个布局,但我希望它的位置精确,其宽度相对于父布局.但如果我这样做
<?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"
android:background="@drawable/fond">
<LinearLayout
android:layout_width="300dp"
android:layout_height="350dp"
android:layout_marginTop="20dp"
android:background="@drawable/fondshare"
android:orientation="vertical" >
Run Code Online (Sandbox Code Playgroud)
你可以看到结果不是我的预期(线性布局是带有笑脸和所有按钮的矩形)

我认为如果你想使用Bitmap作为背景,有一些解决方法:
| 归档时间: |
|
| 查看次数: |
14745 次 |
| 最近记录: |