我想建立一个像这样的http://postimg.cc/image/fihidv1rv/的用户界面.这是我的xml代码,对于我的设计,我希望"EFFECT"和"CAMERA ImageView"在链接中像"SHOP"一样组合,所以总共会有5 ImageView秒,我设置了他们在链接
问题是,我如何设置高度和宽度百分比?
效果+ camrea:高度25%,宽度100%
拼贴:高度25%,宽度50%
绘制:高度25%,宽度50%
照片:身高50%,宽50%
店铺:高25%,宽100%
<RelativeLayout android:id="@+id/mainContent" android:layout_width="fill_parent" android:layout_height="fill_parent"
android:orientation="horizontal" android:background="#ffffff">
<ImageView
android:id="@+id/img_effect+camera"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:src="@drawable/a" />
<ImageView
android:id="@+id/img_collage"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/img_effect+camera"
android:src="@drawable/b" />
<ImageView
android:id="@+id/img_draw"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="@+id/img_effect+camera"
android:layout_toRightOf="@+id/img_collage"
android:src="@drawable/c" />
<ImageView
android:id="@+id/img_photo"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_toRightOf="@+id/img_collage"
android:layout_below="@+id/img_draw"
android:src="@drawable/d" />
<ImageView
android:id="@+id/img_shop"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/img_photo"
android:src="@drawable/e" />
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud) 这是我的viewpager数组中的drawable,当我运行它时,我会导致内存不足错误,有没有办法减少图像大小等?我做了很多搜索,但我也不能使用它们..请帮助...
GalImages = new int[] { R.drawable.tutorials_01_android_en,R.drawable.tutorials_02_android_en,R.drawable.tutorials_03_android_en,R.drawable.tutorials_04};break
@Override
public Object instantiateItem(ViewGroup container, int position) {
ImageView imageView = new ImageView(context);
final int temp = position;
imageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
imageView.setImageResource(GalImages[position]);
((ViewPager) container).addView(imageView, 0);
imageView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {}
});
return imageView;
}
Run Code Online (Sandbox Code Playgroud)