Wrox Programmer Forums
BOOK: Beginning Android Application Development
This is the forum to discuss the Wrox book Beginning Android Application Development by Wei-Meng Lee; ISBN: 978-1-1180-1711-1
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Android Application Development section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old May 19th, 2015, 05:53 AM
Registered User
Join Date: May 2015
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Custom view is ignored while inflating


I have a trouble creating a custom View. When I inflate my xml layout, the com.example.pawel.testapp.CustomKeyboardView tag is ignored. What I do is:

In the SimpleIME.java:
public View onCreateInputView() {
        LinearLayout ll= (LinearLayout)getLayoutInflater().inflate(R.layout.input,null);
        List<View> list = ll.getFocusables(View.FOCUS_FORWARD);
        Log.d("App:", "isEmpty:"list.isEmpty());
        for(View item : list){
            Log.d("App:", item.toString());
In the input.xml:
<?xml version="1.0" encoding="UTF-8"?>
<LinearLayout  xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent"
    android:keyPreviewLayout ="@layout/preview"
<Button android:layout_width="match_parent"
    android:layout_height="wrap_content" >

In the values/attrs.xml:
<?xml version="1.0" encoding="utf-8"?>
    <declare-styleable name="CustomKeyboardView">
        <attr name="android:text"/>
        <attr name="android:textColor"/>
        <attr name="extraInformation" format="string" />
The console output is like:
05-19 09:44:02.089    6658-6658/? D/App:﹕ isEmpty:false
05-19 09:44:02.089    6658-6658/? D/App:﹕ android.widget.Button{301650d5 VFED..C. ......I. 0,0-0,0}
When I delete the Button tag the list becomes empty. I think it means that there's something missing here, so that the inflate method can interpret my CustomKeyboardView proprerly. What should I do?

Similar Threads
Thread Thread Starter Forum Replies Last Post
Error occur when switching form view to datasheet view RinaMY Access 3 March 4th, 2015 06:04 PM
Chapter 4 ToDoList runs but no custom view? scottm BOOK: Professional Android 2 Application Development 8 June 21st, 2010 01:04 PM
Urgent - Send mail with plain view and html view ashish.dadhwal ASP.NET 2.0 Professional 0 November 27th, 2008 01:49 AM
Web Service, Custom Control, Custom Return Type robzyc ASP.NET 2.0 Basics 6 June 10th, 2008 08:03 AM
populate details view or list view non empty rows iinfoque ASP.NET 2.0 Basics 0 March 11th, 2007 06:11 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.