求教,为啥我的TextureView会是漆黑一片

dceacho 2013-10-18 11:04:50

背景我已经改成白色的,怎么还是黑的
...全文
475 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
tantahe 2013-10-18
  • 打赏
  • 举报
回复
Form Widgets里面有TextView
Darcy杨 2013-10-18
  • 打赏
  • 举报
回复
TextureView的背景色要你自己画才行吧? Canvas canvas = lockCanvas(); 想要啥颜色自己canvas.drawColor不就完了嘛
dceacho 2013-10-18
  • 打赏
  • 举报
回复
引用 6 楼 guoyoulei520 的回复:
[quote=引用 5 楼 wangfan027 的回复:] 难道是因为TextureView要GPU支持?
你是用textView还是textureView?[/quote] TextureView我在左边的控件箱里只找到了TextureView,没找到TextView
凉凉二点凉 2013-10-18
  • 打赏
  • 举报
回复
引用 5 楼 wangfan027 的回复:
难道是因为TextureView要GPU支持?
你是用textView还是textureView?
dceacho 2013-10-18
  • 打赏
  • 举报
回复
难道是因为TextureView要GPU支持?
dceacho 2013-10-18
  • 打赏
  • 举报
回复

<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/TableLayout1"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#0099cc"
    tools:context=".FullscreenActivity" >

    <!--
         The primary full-screen view. This can be replaced with whatever view
         is needed to present your content, e.g. VideoView, SurfaceView,
         TextureView, etc.
    -->

    <EditText
        android:id="@+id/editText4"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="16dp"
        android:ems="10"
        android:hint="@string/app_name"
        android:text="@string/ch1" />

    <EditText
        android:id="@+id/editText3"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="16dp"
        android:ems="10"
        android:hint="@string/app_name"
        android:text="@string/ch2" />

    <EditText
        android:id="@+id/editText2"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="16dp"
        android:ems="10"
        android:hint="@string/app_name"
        android:text="@string/ch3" />

    <EditText
        android:id="@+id/editText1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="16dp"
        android:ems="10"
        android:hint="@string/app_name"
        android:text="@string/ch4"
        android:textAlignment="textStart" />

    <ImageButton
        android:id="@+id/imageButton1"
        android:layout_height="48dp"
        android:contentDescription="@string/app_name"
        android:scaleType="fitStart"
        android:src="@android:drawable/btn_star" />

    <com.example.fstest.ImageTextButton
        android:id="@+id/imageTextButton1"
        android:layout_height="48dp"
        android:background="#00000000"
        android:contentDescription="@string/app_name"
        android:scaleType="fitStart"
        android:src="@android:drawable/btn_star"
        android:text="@string/itbutton"
        android:textColor="#cc0000" >

    </com.example.fstest.ImageTextButton>

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="48dp" >

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="match_parent" >

            <ImageView
                android:id="@+id/imageView1"
                android:layout_width="50dp"
                android:layout_height="match_parent"
                android:contentDescription="@string/name_test"
                android:scaleType="fitXY"
                android:src="@android:drawable/ic_menu_report_image" />

        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@color/clor_white"
            android:orientation="vertical" >

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="24dp"
                android:background="@color/clor_white" >

                <TextureView
                    android:id="@+id/textureView_Name"
                    android:layout_width="128dp"
                    android:layout_height="wrap_content"
                    android:background="@color/clor_white"
                    android:text="@string/name_test"
                    android:textAlignment="textStart"
                    android:textStyle="bold" />

                <TextureView
                    android:id="@+id/textureView_Date"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="8dp"
                    android:layout_marginRight="0dp"
                    android:layout_weight="0.72"
                    android:background="@color/clor_white"
                    android:text="@string/time_test" />

            </LinearLayout>

            <TextureView
                android:id="@+id/textureView_Message"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@color/clor_white"
                android:text="@string/message_test" />

        </LinearLayout>

    </LinearLayout>

    <TextView
        android:id="@+id/fullscreen_content"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="center"
        android:keepScreenOn="true"
        android:text="@string/dummy_content"
        android:textColor="#33b5e5"
        android:textSize="50sp"
        android:textStyle="bold" />

    <!--
         This FrameLayout insets its children based on system windows using
         android:fitsSystemWindows.
    -->

</TableLayout>

用模拟器运行了下,第一次运行失败,后来在模拟器里通过桌面图标重新运行了
tantahe 2013-10-18
  • 打赏
  • 举报
回复
实际运行起来也是黑色背景吗? xml发上来看看。
dceacho 2013-10-18
  • 打赏
  • 举报
回复
引用 1 楼 tantahe 的回复:
LinearLayout的背景色是黑色的吗?
那个是白的,你看中间的那块白的就是所在layout的背景色
tantahe 2013-10-18
  • 打赏
  • 举报
回复
LinearLayout的背景色是黑色的吗?

80,351

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧