0

我想在服务上下文中显示两个视图。一个是 TextView,另一个是我开发的扩展基本 View 类的类。
提示.xml:

<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/mtPrompt"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@android:color/background_dark"
    android:text="@string/demoString"
    android:textColor="@android:color/white"
    android:minLines="2"
    android:textSize="25dp" >
</TextView>

和 input.xml:

<com.xxx.ime.sssView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/inputView"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/translucent_gray"
    android:cacheColorHint="@null" >

</com.xxx.ime.sssView>

在我的 onInitializeInterface() 实现中,我将它们膨胀如下:

 sssView sv = 
        (sssView) getLayoutInflater().inflate(R.layout.input, null);
 TextView tv = 
        (TextView) getLayoutInflater().inflate(R.layout.prompt, null);

我看到了 sssView,但没有看到 TextView。任何想法为什么?

4

1 回答 1

0

这不是一个完整的答案,但它是一个解决方案。我需要做的不是拥有两个单独的视图,而是从 TextView 而不是视图继承我的 sssView。然后我放大了一个视图,并使用重力将我的文本放置在我想要的位置。

于 2012-08-09T16:02:43.850 回答