I used this Code:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:background="#drawable/backrepeat"
android:gravity="center"
android:orientation="vertical" >
in my layoutfile
and this in backrepeat.xml
<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="#drawable/mainmenu_background"
android:tileMode="repeat" />
But in the Graphical Layout i get the following Error:
Failed to parse file [...]res\drawable\backrepeat.xml
What i am doing wrong ? Im using the Android 2.3.3 Library.
You need to have a drawable named mainmenu_background. This can be an image (/res/drawable/mainmenu_background.png), a nine-patch image (/res/drawable/mainmenu_background.9.png) or defined in XML ( /res/drawable/mainmenu_background.xml). The file name mustn't contain upper cased letter or any special character except underscore(_).
Related
This is the .xml file
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:seekarc="http://schemas.android.com/apk/res/com.pelkinsoft.enpower"
android:layout_width="match_parent"
android:layout_height="match_parent" >
The errors occur at:
<com.triggertrap.seekarc.SeekArc
android:id="#+id/seekArc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:padding="30dp"
seekarc:progressColor="#color/arc_color"
seekarc:rotation="180"
seekarc:startAngle="30"
seekarc:sweepAngle="300"
seekarc:touchInside="true" />
I am new to Android and this is keeping me from being able to effectively work on this app. Any help would be much appreciated.
You must add the Seek Arc library (https://github.com/neild001/SeekArc#adding-to-your-project) to your project
Inside res foder, create following file:
res/values/color.xml
Then, define the color used by SeekArc view:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="arc_color">#0000FF</color>
</resources>
OR
Manually set the color in the SeekArk view:
<com.triggertrap.seekarc.SeekArc
android:id="#+id/seekArc"
android:layout_width="match_parent"
....
seekarc:progressColor="#0000FF"
....
/>
How can i repeat an image on background? I'm trying to put an image (a notebook sheet) into a scrollview. But i can't figure out how to make it. Can you give me an example?
I'm new at android programming.
PD:Sorry for my bad english.
If i unterstand you correctly, This way help you.
Import a drawable image like that "img_blue_gray.png"
Then create a xml file in Drawable Folder
repeating.xml
<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="#drawable/img_blue_gray"
android:tileMode="repeat"
/>
For example: usage in Layout.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parrent"
android:layout_height="match_parrent"
android:orientation="vertical">
<ScrollView
android:id="#+id/scrollView2"
android:layout_width="match_parrent"
android:layout_height="match_parrent"
android:layout_gravity="center_horizontal"
android:background="#drawable/repeating.xml">
/* Your other views */
</ScrollView>
</LinearLayout>
I am starting out with Xamarin studio, I have build most basic forms project. In tutorials it shows how to edit layout in Main.xml, that is supposed to be in Resources/layout that is missing in my solution. So when I add it manually it then fails with error message The layout contains malformed XML and another one Root element is missing. When I opened the Main.xml in notepad I can see contents to be <?xml version="1.0" encoding="UTF-8" ?>.
How do contents of proper blank Main.xml supposed to be like?
Review that the markups are start and close correctly; for example,
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:background="#drawable/fondomizzou" **/>**
NOT
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:background="#drawable/fondomizzou"
**</RelativeLayout> />**
Figured it out myself
Click on source, then add
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
and that should do it.
I have been following a book on Android "Beginning Android Application". I have been trying to figure out an application which shows images in a view. But unfortunately I could not run the application because of the following errors:
[2012-04-24 19:37:33 - Gallery] F:\eclipse workspace\Gallery\res\values
\attrs.xml:2:error: Found text "
[2012-04-24 19:37:33 - Gallery] ​​​​ " where item tag is expected
For convenience I am giving here the codes.
main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Bilai"
/>
<Gallery
android:id="#+id/gallery1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
<ImageView
android:id="#+id/image1"
android:layout_width="320px"
android:layout_height="250px"
android:scaleType="fitXY"
/>
</LinearLayout>
This application requires another xml file. It is named as attrs.xml under res/values.
attrs.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="Gallery1" >
<attr name="android:galleryItemBackground" />
</declare-styleable>
</resources>
I think the problem lies within attrs.xml, but I dont know whats going on. And because of this the R.styleable also doesnt work either. Please help. Thanks in advance
I think you have some characters before each line in your attrs.xml due to a copy/past method.
Can you try to reformat your code by placing your text cursor at the beginning of each line and delete to return to previous line ?
I have a pattern-based background drawable:
<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="#drawable/back"
android:tileMode="repeat"/>
On this activity I'm displaying a background-pattern:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#drawable/back"
android:scrollbars="vertical"
>
</LinearLayout
Have a result like:
http://img525.imageshack.us/img525/2257/63411225.jpg
Need result:
http://img811.imageshack.us/img811/4894/12572985.jpg
You are not including the necessary code (the layout that has both your background, and the image).
The problem has nothing to do with your background, and (probably) everything to do with how you are actually laying out your image.
If this is you complete code, you need to add a attribute, which would include you Image.