动态设置滚动视图后,按钮停止工作

时间:2019-01-27 21:26:28

标签: java android scrollview

我的布局如下:

const robot = this._electronService.remote.require('robotjs');
// The example supplied by robotjs
robot.setMouseDelay(2);

const twoPI = Math.PI * 2.0;
const screenSize = robot.getScreenSize();
const height = (screenSize.height / 2) - 10;
const width = screenSize.width;

for (let x = 0; x < width; x++) {
  const y = height * Math.sin((twoPI * x) / width) + height;
  robot.moveMouse(x, y);
}

我通过以下代码实用地添加textViews:

<Relative Layout>
    <Scroll View>
        <Linear Layout>
          <Text View --1>
            '
            '
            '
          <Text View --n>
         <Linear Layout>
    <Scroll View>

    <Image View>
           // Clickable Image View using as button using onClickLister  
    <Image View>

<Relative Layout>

列表是包含哈希映射的arrayList。

每当我以编程方式更新滚动视图时,bitton便停止工作。

我正在从事一个android项目 这是代码:

int length = list.size();
setContentView(R.layout.activity_chat);
LinearLayout linearLayout = (LinearLayout) findViewById(R.id.linear);

for(int i=0; i<length;i++) {
        TextView textView1 = new TextView(this);
        textView1.setLayoutParams(new 
LayoutParams(LayoutParams.WRAP_CONTENT,
                LayoutParams.WRAP_CONTENT));
        textView1.setText(list.get(i).get("time")+">>>"+" 
  "+list.get(i).get("message"));
        textView1.setPadding(5, 10, 5, 10);// in pixels (left, top, right, 
 bottom)
        linearLayout.addView(textView1);

我是编程新手,请帮助我如何解决此问题。我想完成我的项目。

0 个答案:

没有答案