【发布时间】:2011-11-26 04:42:52
【问题描述】:
我想知道是否有某种方法可以让相机预览填充屏幕的一部分,并且在底部有一个文本视图框,我可以稍后在其中添加文本。 我还没有任何代码,因为在继续编写代码之前,我的团队仍在评估这是否可行。
编辑 2:现在我在玩了 android:gravity 之后终于可以在屏幕上看到文字了。但是TextView总是显示在屏幕的顶部,有什么办法可以把它移到底部吗?
编辑 3:将 android:layout_height 更改为 fill_parent 而不是 wrap_content 修复了定位问题
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<SurfaceView android:id="@+id/preview_view"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_centerInParent="true"/>
<com.google.zxing.client.android.ViewfinderView
android:id="@+id/viewfinder_view"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/transparent"/>
........
........
<TextView android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="bottom"
android:text="Header text"/>
</FrameLayout>
【问题讨论】:
标签: android camera preview textview