背景图像不能插入

时间:2016-08-07 13:24:17

标签: android android-layout android-studio

我想在我的程序中插入图像为bg。我添加了 andriod:background 但我没有在设计部分获取图像

`

 <?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="match_parent"
    android:layout_height="match_parent"
    xmlns:andriod="http://schemas.android.com/apk/res-auto"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="16dp"
    android:paddingRight="16dp"
    android:paddingTop="16dp"
    tools:context="com.example.madhu.c_indicator.MainActivity"
    andriod:background="@drawable/bg2">



</RelativeLayout>

当我运行程序时出现以下错误

"C:\Program Files\Java\jdk1.8.0_77\bin\java" -ea -Didea.launcher.port=7535 "-Didea.launcher.bin.path=C:\Program Files\Android\Android Studio\bin" -Didea.junit.sm_runner -Dfile.encoding=UTF-8 -classpath "C:\Program Files\Android\Android Studio\lib\idea_rt.jar;C:\Program Files\Android\Android Studio\plugins\junit\lib\junit-rindicatort.jar;C:\Users\MADHU\AppData\Local\Android\sdk\platforms\android-23\data\res;C:\Users\MADHU\AndroidStudioProjects\C-\app\build\intermediates\classes\test\debug;C:\Users\MADHU\AndroidStudioProjects\C-indicator\app\build\intermediates\classes\debug;C:\Users\MADHU\AppData\Local\Android\sdk\extras\android\m2repository\com\android\support\support-annotations\23.4.0\support-annotations-23.4.0.jar;C:\Users\MADHU\AndroidStudioProjects\C-indicator\app\build\intermediates\exploded-aar\com.android.support\animated-vector-drawable\23.4.0\jars\classes.jar;C:\Users\MADHU\AndroidStudioProjects\C-indicator\app\build\intermediates\exploded-aar\com.android.support\animated-vector-drawable\23.4.0\res;C:\Users\MADHU\.gradle\caches\modules-2\files-2.1\org.hamcrest\hamcrest-core\1.3\42a25dc3219429f0e5d060061f71acb49bf010a0\hamcrest-core-1.3.jar;C:\Users\MADHU\AndroidStudioProjects\C-indicator\app\build\intermediates\exploded-aar\com.android.support\support-v4\23.4.0\jars\libs\internal_impl-23.4.0.jar;C:\Users\MADHU\AndroidStudioProjects\C-indicator\app\build\intermediates\exploded-aar\com.android.support\support-v4\23.4.0\res;C:\Users\MADHU\AndroidStudioProjects\C-indicator\app\build\intermediates\exploded-aar\com.android.support\support-v4\23.4.0\jars\classes.jar;C:\Users\MADHU\.gradle\caches\modules-2\files-2.1\junit\junit\4.12\2973d150c0dc1fefe998f834810d68f278ea58ec\junit-4.12.jar;C:\Users\MADHU\AndroidStudioProjects\C-indicator\app\build\intermediates\exploded-aar\com.android.support\support-vector-drawable\23.4.0\res;C:\Users\MADHU\AndroidStudioProjects\C-indicator\app\build\intermediates\exploded-aar\com.android.support\support-vector-drawable\23.4.0\jars\classes.jar;C:\Users\MADHU\AndroidStudioProjects\C-indicator\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\23.4.0\jars\classes.jar;C:\Users\MADHU\AndroidStudioProjects\C-indicator\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\23.4.0\res;C:\Users\MADHU\AndroidStudioProjects\C-indicator\app\build\intermediates\sourceFolderJavaResources\test\debug;C:\Users\MADHU\AndroidStudioProjects\C-indicator\app\build\intermediates\sourceFolderJavaResources\debug;C:\Users\MADHU\AndroidStudioProjects\C-indicator\build\generated\mockable-android-23.jar" com.intellij.rt.execution.application.AppMain com.intellij.rt.execution.junit.JUnitStarter -ideVersion5 @w@C:\Users\MADHU\AppData\Local\Temp\idea_working_dirs_junit0.tmp @C:\Users\MADHU\AppData\Local\Temp\idea_junit0.tmp -socket50943
0 test classes found in package 'drawable'

Process finished with exit code -1
Empty test suite.

plsss帮助我

3 个答案:

答案 0 :(得分:1)

行andriod中有拼写错误:background =&#34; @ drawable / bg2&#34;改变&#39; andriod&#39;到&#39; android&#39;

答案 1 :(得分:0)

你的代码中有拼写错误,所以

更改

$this->blog_db->query('SELECT a.tytul, b.post_id, a.data_dodania, COUNT(b.post_id) as liczba
                                    FROM posts a
                                    JOIN komentarze b ON a.id=b.post_id
                                    GROUP BY b.post_id
                                    ORDER BY liczba desc
                                    LIMIT 0, 5
                                    ');

andriod:background="@drawable/bg2"

答案 2 :(得分:0)

您的代码上有拼写错误。 而不是'andriod:background'使用''android:background'