-1
A
回答
0
您可以在这里找到一个解决方案:
https://stackoverflow.com/a/25143739/5907003
如果你想calculate the height dynamically您可以使用下面的代码:
int finalHeight, finalWidth;
final ImageView iv = (ImageView)findViewById(R.id.scaled_image);
final TextView tv = (TextView)findViewById(R.id.size_label);
ViewTreeObserver vto = iv.getViewTreeObserver();
vto.addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
public boolean onPreDraw() {
iv.getViewTreeObserver().removeOnPreDrawListener(this);
finalHeight = iv.getMeasuredHeight();
finalWidth = iv.getMeasuredWidth();
tv.setText("Height: " + finalHeight + " Width: " + finalWidth);
return true;
}
});
还只是一个想法,如果可以帮助,你可以将图像分成两部分,并将它们与您的布局对齐,以对齐底部并将顶部对齐相应的布局
对于圆角背景,您可以在可绘制文件夹中创建一个bg.xml
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#FFFFFF"/>
<stroke android:width="3dip" android:color="#B1BCBE" />
<corners android:radius="10dip"/>
<padding android:left="0dip" android:top="0dip" android:right="0dip" android:bottom="0dip" />
</shape>
祝你好运!
1
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.testing.MainActivity" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:background="#0000ff"
android:orientation="vertical"
android:layout_weight="1" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:background="#00ffff"
android:orientation="vertical"
android:layout_weight="1" />
</LinearLayout>
<LinearLayout
android:layout_width="100dp"
android:layout_height="100dp"
android:orientation="vertical"
android:background="#00ff00"
android:layout_gravity="center" />
</FrameLayout>
相关问题
- 1. 将Android屏幕分成两半等分
- 2. Android-将屏幕分为两部分。并使左屏幕不变
- 3. 将屏幕拆分为两部分
- 4. 将表格分成两半
- 5. 分割屏幕一半CSS
- 6. 如何将一副牌分成两半?
- 7. 将MapView限制为屏幕的一半
- 8. xml分成两半
- 9. 将UiImageView水平分割成两半?
- 10. 在屏幕的右半部分放置背景图像
- 11. 将NSArray的后半部分与前半部分交错
- 12. 如何使一个ListFragment仅占用屏幕的上半部分
- 13. 分裂Lucene索引分为两半
- 14. 地图下半部分和上半部分屏幕在Google地图v2中为空
- 15. 如何将有序数据帧拆分为前半部分和后半部分
- 16. 调整浏览器屏幕的两半
- 17. 在Android屏幕的上半部分显示当前位置
- 18. 将屏幕分为两部分iphone box2d游戏应用
- 19. Ionic 2:将屏幕拆分为两个独立部分
- 20. 在屏幕的一半部分打开相机 - iPhone
- 21. fullpage.js activepage显示两个半部分
- 22. ScrolledComposite垂直分割屏幕,内容显示在右半部分
- 23. 将ImageView设置为ScrollView中屏幕高度的一部分
- 24. 如何在Android中将屏幕分成两部分?
- 25. 在为TextViews(Android)使用边框时将屏幕分割为一半(水平)
- 26. 将ul分成两半,然后将这两个部分围成一个div(动态菜单中的徽标)
- 27. 将UIImage拆分成一半?
- 28. 将Ienumerable分为两部分
- 29. 将RelativeLayout分为两部分
- 30. 将Linklist分为两部分
下部应根据版面内容 –
可以使用在较低的线性布局 –
但上半部分滚动型也应随之移动起来是高度伸展。 –