有办法删除注释吗?
这个RelativeLayout布局或它的LinearLayout父级是无用的;将背景属性转移到另一个视图
在我的xml文件中保留相同的输出?
我使用带有自定义适配器的xml文件在ListView上设置通知。
如果我将listview(见下面)的宽度更改为@dimen/notifications(通知大小),它可以转到屏幕的中心,但是空区域(通知的右和左)是不可滚动的。
如何删除注释并保留可滚动区域?
P.S. IDE Eclipse

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal" >
<RelativeLayout
android:layout_width="@dimen/notification_width"
android:layout_height="wrap_content"
android:background="@drawable/borders" >
<TextView
android:text="@string/notify_start"
android:id="@+id/notificationText"
style="@style/TextLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Button
android:id="@+id/notificationBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_below="@id/notificationText"
android:text="@string/button_move_to" />
</RelativeLayout>
</LinearLayout>删除线性布局或相关布局之后

(去掉线性布局)
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="@dimen/notification_width"
android:layout_height="wrap_content"
android:background="@drawable/borders"
android:gravity="center_horizontal" >
<TextView
android:text="@string/notify_start"
android:id="@+id/notificationText"
style="@style/TextLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Button
android:id="@+id/notificationBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_below="@id/notificationText"
android:elevation="@dimen/elevation"
android:text="@string/button_move_to" />
</RelativeLayout>(删除相对布局)
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="@dimen/notification_width"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:orientation="vertical"
android:background="@drawable/borders">
<TextView
android:text="@string/notify_start"
android:id="@+id/notificationText"
style="@style/TextLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Button
android:id="@+id/notificationBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right|bottom"
android:text="@string/button_move_to" />
</LinearLayout>ListView
<ListView
android:id="@+id/notificationList"
style="@style/CustomScroller"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/scroolbar_margin"
android:divider="@android:color/transparent"
android:dividerHeight="@dimen/spacer_height" />发布于 2015-10-01 13:16:08
<ScrollView
android:layout_height="match_parent"
android:fillViewport="true"
android:layout_width="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<ListView
android:id="@+id/notificationList"
style="@style/CustomScroller"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/scroolbar_margin"
android:divider="@android:color/transparent"
android:dividerHeight="@dimen/spacer_height" />
</ScrollView>https://stackoverflow.com/questions/32888371
复制相似问题