如何在android studio中使图像无效

时间:2015-12-12 00:58:30

标签: java android xml android-studio

我在content_main.xml中有Imagebotton,代码为:

var buf = '';
req.on('data', function(data) {
  // Here `data.toString()` is called implicitly because you a
  // non-string object has to be converted somehow in order to be
  // added to `buf`. When this implicit conversion happens, the result
  // will be the concatenation of `buf` + `data` converted to a UTF-8
  // string because that is the default encoding argument for
  // `buffer.toString()`
  buf += data;
  // You can even check that it's a buffer with:
  console.log(Buffer.isBuffer(data));
});

并显示: enter image description here

但我希望imageBotton没有框效果,例如: enter image description here

而且,我将使这个imageBotton转到下一个布局

我该怎么办?

3 个答案:

答案 0 :(得分:0)

您的图片似乎比提供的尺寸大。如果使用wrap_content,则可以看到整个图像,而不是固定的高度和宽度。像这样:

public class Node1 {
        String lname;
        String fname;
        int age;
        Node1 lChild;
        Node1 rChild;
        public Node1( String l, String f, int a)
        {
            this.lname = l;
            this.fname = f;
            this.age = a;
            lChild = null;
            rChild = null;
        }
        public String toString()
        {
            return(" the age for "+fname+" "+ lname +" is "+ age);
        }
    }

如果您希望图像没有框效果,可以尝试添加透明背景的图像。

答案 1 :(得分:0)

android:src="@drawable/ic_launcher"

的内容

尝试使用

android:background="@drawable/ic_launcher"

示例:

 <ImageButton
            android:background="@drawable/ic_launcher"
            android:layout_width="110dp"
            android:layout_height="130dp"
            android:id="@+id/imageButtonTri"
            android:layout_marginLeft="75dp"
            />

答案 2 :(得分:0)

  <ImageButton
        android:src="@drawable/tri1"
        android:layout_width="110dp"
        android:layout_height="130dp"
        android:scaleType="fitCenter"
        android:background="@android:color/transparent"
        android:id="@+id/imageButtonTri"
        android:layout_marginLeft="75dp"
        />