0
首先發布這裏,所以任何錯誤提前道歉。使用LayoutInflater使覆蓋透明
我想添加一些按鈕作爲覆蓋到相機預覽,並且一切都按預期工作,除了按鈕變透明時,無論我嘗試什麼時,我都希望它們是不透明的。
我這是怎麼吹的佈局:
LayoutInflater inflater = getLayoutInflater();
View controls = inflater.inflate(R.layout.test, null);
LayoutParams layoutParamsControl = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
this.addContentView(controls, layoutParamsControl);
這是爲控制XML文件什麼樣子:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<Button
android:id="@+id/button_capture"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center_horizontal"
android:text="Capture" />
<Button
android:id="@+id/button_mapview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|right"
android:text="Map" />
</FrameLayout>
</LinearLayout>
我的問題是沒有人知道爲什麼我的按鈕變得透明以及如何解決它?
嘗試添加顏色作爲背景像android:background =「#ffffff」 –
這工作完美,謝謝!我不確定我是否可以接受評論作爲答案? – Stjernstedt