0

I'm new in android and I've found this great android page curl in this link http://code.google.com/p/android-page-curl/. My question is, how to add TextView?? I've tried it but it always force close when i try. Here is my code in layout xml.

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent" android:layout_height="fill_parent">
    <cv.tarie.pagecurl.PageCurlView
        android:layout_width="fill_parent" android:layout_height="fill_parent"
        android:id="@+id/dcgpagecurlPageCurlView1"/>

    <LinearLayout android:id="@+id/textlayout"
        android:layout_width="fill_parent" android:layout_height="100dp"
        android:layout_alignParentBottom="true" android:gravity="center"
        android:background="#55000000" android:padding="5dp">

        <TextView android:id="@+id/dialog" android:layout_width="fill_parent"
            android:layout_height="fill_parent" android:textSize="18dp"
            android:textColor="#FFFFFF" />

    </LinearLayout>
</RelativeLayout>

And i add this code in PageCurlView.

TextView tv = (TextView) findViewById(R.id.dialog);
tv.setText("Hello!");

There are wrong in my code??

Thanks..

Faras
  • 59
  • 1
  • 7

1 Answers1

0

You should give some more information: where did you add that code exactly; what is the logcat output, ...

Anyways, from just looking at your XML, a simple question to yourself: Why should the PageCurlView be able to find the TextView element, which is NOT a children of it?

You have:

  • RelativeLayout
    • PageCurlView
    • LinearLayout
      • TextView

The TextView is only children of the RelativeLayout and the LinearLayout. It's not possible to find the TextView in PageCurlView. FindViewById() only descents into a ViewGroups childrens, not parents.

I just thinking about, probably, your questions was completely wrong. Did you try to ask "How to make PageCurl switch between TextViews, not only Images?". The answer is: Read the documentation, or just the very first page of the main web site. It is NOT possible. It only is able to switch between images.

Oliver
  • 1,269
  • 13
  • 21
  • ok.. that's my fault cause i'm new in android.. :D i just try to make text with transparent background.. :) – Faras Aug 02 '12 at 03:35
  • @user1561886: So, what was your question again? Does it even has something to do with the PageCurlView? ;) – Oliver Aug 02 '12 at 03:43
  • Mmm.. yes i'm wrong. I just need to make TextView with black transparent background and i want when the page is fliped the text is change. I need to do research now before ask the question again. -.-" btw, thanks for answer my question. :) – Faras Aug 02 '12 at 04:03