当我尝试旋转相对布局时,我在底部得到空白区域......这是我的xml布局
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
<RelativeLayout
android:id="@+id/columnLayout"
android:layout_width="match_parent"
android:layout_height="20dp"
android:layout_marginLeft="40dp">
<ListView
android:id="@+id/columnlistview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#b0b0b0" />
</RelativeLayout>
</RelativeLayout>
这就是我试图旋转相对布局的方式
RelativeLayout columnLayout = (RelativeLayout) findViewById(R.id.columnLayout);
int w = columnLayout.getWidth();
int h = columnLayout.getHeight();
columnLayout.setRotation(270.0f);
columnLayout.setTranslationX((w - h)/2);
columnLayout.setTranslationY((h - w)/2 );
ViewGroup.LayoutParams lp=(ViewGroup.LayoutParams)columnLayout.getLayoutParams();
lp.height = w;
lp.width = h;
columnLayout.requestLayout();
任何人都可以帮我解决如何摆脱空白..
TIA,
VijayRaj
答案 0 :(得分:0)
将listView的高度和宽度更改为match_parent
答案 1 :(得分:0)
<ListView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:rotation="270" />