Android - 布局SurfaceView和图像视图

时间:2015-06-06 02:44:08

标签: android imageview surfaceview

当我尝试将图像视图放在表面视图上时,我收到错误。

这是我的XML代码,请帮助我这方面

module slice_issue ();

// clock and reset 
reg board_resetl;
reg tb_clkh;
parameter CLK_PER  = 4;


always #(CLK_PER/2) tb_clkh = ~ tb_clkh;

initial begin: main_process
  board_resetl = 0;
  tb_clkh = 0;

  #100 
  @(posedge tb_clkh);  
  board_resetl = 1;

 end



localparam logic [4:0] PARAM_1 = 14;
localparam logic [4:0] PARAM_2 = 18;
localparam logic [4:0] PARAM_3 = 26;

localparam [0:2] [4:0] CAND_MODE_LIST = {PARAM_1, PARAM_2, PARAM_3};

logic [1:0] temp;
logic [4:0] temp2;

logic [1:0] in_pred_mode;

logic [4:0] cnt_reg; 

always @ (posedge tb_clkh or negedge board_resetl) 
    begin  
       if (~board_resetl) begin 
          in_pred_mode <= 0; 
          cnt_reg  <= 0;
       end else  
          cnt_reg  <= cnt_reg + 1; 
       if (cnt_reg == 31) begin
          in_pred_mode <= $urandom_range(0, 1); 
       end
    end

// bad
assign temp  = CAND_MODE_LIST[in_pred_mode][1:0];

// good 
assign temp2  = CAND_MODE_LIST[in_pred_mode];

endmodule

上面的代码可以正常工作,如果我将添加表面视图和图像向下,但我想要其他方法。

1 个答案:

答案 0 :(得分:0)

这样的东西?

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/white"
android:orientation="vertical">

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#EFE3AF"
    android:orientation="vertical">

    <FrameLayout
        android:layout_width="fill_parent"
        android:layout_height="500dp"
        android:layout_weight="1">

        <SurfaceView
            android:id="@+id/surfaceview"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:background="@null"
             />



            <ImageView
                android:layout_gravity="top|right"
                android:id="@+id/imageView1"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:background="#FF0000" />


    </FrameLayout>
</LinearLayout>
</RelativeLayout>