Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Mobile Development > BOOK: Beginning Android Application Development
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old May 19th, 2015, 05:53 AM
Registered User
Points: 5, Level: 1
Points: 5, Level: 1 Points: 5, Level: 1 Points: 5, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2015
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Custom view is ignored while inflating

Hello,

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:
Code:
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());
        //todo
        for(View item : list){
            Log.d("App:", item.toString());
        }
...
In the input.xml:
Code:
<?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:layout_height="wrap_content">
<com.example.pawel.testapp.CustomKeyboardView
    android:id="@+id/input"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:keyPreviewLayout ="@layout/preview"
    >ddd</com.example.pawel.testapp.CustomKeyboardView>
<Button android:layout_width="match_parent"
    android:layout_height="wrap_content" >


</Button>
</LinearLayout>
In the values/attrs.xml:
Code:
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <declare-styleable name="CustomKeyboardView">
        <attr name="android:text"/>
        <attr name="android:textColor"/>
        <attr name="extraInformation" format="string" />
    </declare-styleable>
</resources>
The console output is like:
Code:
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?
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Error occur when switching form view to datasheet view RinaMY Access 3 March 4th, 2015 05: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 12: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



All times are GMT -4. The time now is 10:18 AM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.