在我的应用程序中,我有一个标题(TextView)和一个图像。图像是从网络抓取的,大多数图像都是不同的大小。其中一些图像很高,在我的文本视图上重叠,覆盖它。反正有没有阻止这个?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/screen"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<android.gesture.GestureOverlayView
android:id="@+id/gestures"
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1.0"
>
<TextView
android:id="@+id/title"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text=""
android:paddingBottom="10px"
android:layout_weight="1.0"
/>
<ImageView
android:id="@+id/picview"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:padding="10px"
android:cropToPadding="true"
android:layout_weight="0.0"
/>
</android.gesture.GestureOverlayView>
</LinearLayout>
答案 0 :(得分:0)
我认为问题出在android:layout_height =“fill_parent”因为你已经创建了高度与父视图匹配的imageview,所以请将它设为“wrap_content”而不是“fill_parent”。
修改强> 如果您想要显示尺寸(以像素为单位),可以使用
Display display = getWindowManager().getDefaultDisplay();
int width = display.getWidth();
int height = display.getHeight();