Java 如何在Android中增加视图高度?
我在Android应用程序中创建了布局中间的视图。但是我想通过按键盘上的二进制数字来增加视野的高度。我不知道如何实施它 这是我的XML文件:Java 如何在Android中增加视图高度?,java,android,Java,Android,我在Android应用程序中创建了布局中间的视图。但是我想通过按键盘上的二进制数字来增加视野的高度。我不知道如何实施它 这是我的XML文件: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center"
android:orientation="vertical"
android:padding="20dp" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingBottom="20dp"
android:text="@string/textstr" />
<View
android:layout_width="70dp"
android:layout_height="150dp"
android:background="#9400d3" />
</LinearLayout>
1)在视图中添加ID
2) 在编码方面:
试着这样做:
view_object.setLayoutParams(new ViewGroup.LayoutParams(80,160));
当我按下键盘上的任何数字时,我会提到上述描述。我的视图高度会增加。