Android 理解布局和尺寸标注
经过一段漫长的休息之后,我将回到android,我觉得我已经失去了我的modjo 我正在尝试建立一个具有相对布局的一天计划,稍后我将用事件填充它 以下是我的活动的内容视图:Android 理解布局和尺寸标注,android,android-layout,Android,Android Layout,经过一段漫长的休息之后,我将回到android,我觉得我已经失去了我的modjo 我正在尝试建立一个具有相对布局的一天计划,稍后我将用事件填充它 以下是我的活动的内容视图: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" androi
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
<ScrollView
android:layout_width="600dp"
android:layout_height="fill_parent" >
<RelativeLayout
android:id="@+id/day_main_relative"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
<RelativeLayout
android:id="@+id/day_title_relative"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="3"
android:background="@color/blue" >
<View //SEPARATOR
android:layout_width="2dp"
android:layout_height="0dp"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:background="@color/black" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/day_content_relative"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="10"
android:background="@color/light_orange" />
</LinearLayout>
</RelativeLayout>
</ScrollView>
规划在滚动视图中。我的想法是在“day_main_relative”中填入我想要定义相对布局高度的行。我必须保持活力,所以我做了这样的事情:
for (int i = 0; i < Constants.HOUR_RANGE; i++) {
// Cadrillage
ViewGroup separator = (ViewGroup) inflater.inflate(
R.layout.week_separator_layout, planningMainLayout, false);
ViewGroup.MarginLayoutParams separatorParams = (ViewGroup.MarginLayoutParams) separator
.getLayoutParams();
separatorParams.setMargins(0,
DpHourLabel.convertValueToDpDay(i * 60), 0, 0);
separator.setLayoutParams(separatorParams);
planningMainLayout.addView(separator);
for(int i=0;i
然后我希望我的线性布局在它里面最大限度地延伸
简而言之,我想要这样的东西(在contentView的分隔符“View”元素中有一条黑线):
但我得到的是:
为什么不使用
列表视图
?主要是因为我可以从3h27和3h47中选择一个事件,而从3H30到7H18的另一个事件必须显示良好。无论如何,我的问题主要是了解布局是如何构建的