请参阅以下XML代码
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<include layout="@layout/header" />
<TextView
android:layout_width="fill_parent"
android:layout_height="18dp" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/header"
android:orientation="horizontal" >
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:src="@drawable/calendar" />
<TextView
android:id="@+id/tvTitle"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:gravity="center"
android:text="@string/calendar"
android:textColor="#FFFFFFFF"
android:textSize="18sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/myLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
</LinearLayout>
<!-- <include layout="@layout/footer"/> -->
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="@drawable/datename_bottom_bg"
android:orientation="horizontal">
<TextView
android:id="@+id/upgrade_4"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_weight="1"
android:drawableTop="@drawable/upgrade"
android:gravity="center"
android:text="@string/upgrade"
android:textSize="8sp" />
<TextView
android:id="@+id/panchang_4"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_weight="1"
android:drawableTop="@drawable/kalash_bottom"
android:gravity="center"
android:text="@string/panchang"
android:textSize="8sp" />
<TextView
android:id="@+id/time_range_4"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_weight="1"
android:drawableTop="@drawable/timer_bottom"
android:gravity="center"
android:text="@string/timespan"
android:textSize="8sp" />
<TextView
android:id="@+id/reminder_4"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_weight="1"
android:drawableTop="@drawable/reminder_bottom"
android:gravity="center"
android:text="@string/reminders"
android:textSize="8sp" />
<!--
<TextView android:id="@+id/calendar_4" android:layout_width="50dp" android:layout_height="50dp" android:drawableTop="@drawable/calendar_bottom"
android:text="@string/calendar" android:textSize="8sp" android:gravity="center" android:layout_weight="1"/>
-->
</LinearLayout >
</LinearLayout>
</ScrollView>
Run Code Online (Sandbox Code Playgroud)
这看起来像是在左侧,我希望它看起来像是在右边,我也尝试通过将LinearLayout替换为RelativeLaout但仍然无法正常工作.请帮忙.!


Via*_*lav 29
你应该使用RelativeLayout,例如
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffff0000"
android:layout_above="@+id/bottom_panel">
</ScrollView>
<LinearLayout
android:id="@+id/bottom_panel"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true">
<Button
android:layout_width="0dip"
android:layout_weight="1"
android:layout_height="wrap_content"
android:text="Button 1"/>
<Button
android:layout_width="0dip"
android:layout_weight="1"
android:layout_height="wrap_content"
android:text="Button 2"/>
<Button
android:layout_width="0dip"
android:layout_weight="1"
android:layout_height="wrap_content"
android:text="Button 3"/>
<Button
android:layout_width="0dip"
android:layout_weight="1"
android:layout_height="wrap_content"
android:text="Button 4"/>
</LinearLayout>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
这会给你类似的东西.只需放置小部件而不是我的按钮.

| 归档时间: |
|
| 查看次数: |
44857 次 |
| 最近记录: |