Reputation: 41
I am attempting to use the layout tricks #3 described in Android Layout Tricks #3: Optimize, Part 1 and I am getting an error when its trying to find the png file that I am using as the button obj my XML file for the button bar is the following .....
<?xml version="1.0" encoding="UTF-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android">
<include
layout = "@drawable/button_yes"
android:id="@+id/okLabel" />
<include
layout="@drawable/button_no"
android:id="@+id/cancelLabel" />
</merge>
and this is called by the java script......
package com.bobocode.culliganapp;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.FrameLayout;
public class OkCancelBar extends FrameLayout {
public OkCancelBar(Context context, AttributeSet attrs) {
super(context, attrs);
LayoutInflater.from(context).inflate(R.layout.okcancelbar, this, true);
}
}
which is being instantiated by ..............
<merge
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:okCancelBar="http://schemas.android.com/apk/res/com.bobocode.culliganapp">
<FrameLayout android:background="@drawable/culliganapp1"
android:id="@+id/secondpage"
android:layout_width="wrap_content" android:layout_height="wrap_content">
<TextView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginBottom="20dip"
android:layout_gravity="center|center"
android:padding="12dip"
/>
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="20dip"
android:layout_gravity="center|center"
android:padding="12dip"
android:background="@color/white"
android:textSize="24sp"
android:textColor="@color/black"
android:text="Does your water have an unpleasant taste or odor?"
android:id="@+id/question"
/>
</FrameLayout>
<com.bobocode.culliganapp.OkCancelBar
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:paddingTop="8dip"
android:gravity="center_horizontal"
android:background="#AA000000"
okCancelBar:okLabel="Yes"
okCancelBar:cancelLabel="No"
/>
</merge>
any help would surely be appreciated
Upvotes: 0
Views: 1148
Reputation: 3254
Use normal character like "yesbutton" . And i don't know why you want to do :
Layout ="@drawable/button_yes"
just do something like android:background="@drawable/yesbutton"
i don't know what
layout is, is not even android because all attributs starts with "android:".
Upvotes: 0
Reputation: 73484
If you want to specify a drawable for your background you'll need to include the png in your drawable directory and specify it on your OkCancelBar with android:background="drawable/somepng"
.
Upvotes: 2