[英]ListView ScrollAble Area
Is there a way to remove the annotation 有没有办法删除注释
This RelativeLayout layout or its LinearLayout parent is useless; 此RelativeLayout布局或其LinearLayout父级是无用的。 transfer the background attribute to the other view 将background属性转移到另一个视图
that I have in my xml file and keep the same output? 在我的xml文件中并保持相同的输出?
I am using the xml file with a custom Adapter to set notifications on ListView 我正在使用带有自定义适配器的xml文件在ListView上设置通知
If I change the listview(see below) width to the @dimen/notification_width(notifications size) it can go the the center of the screen but then empty area (right and left of notification) isn't scrollable. 如果我将listview(见下文)宽度更改为@ dimen / notification_width(通知大小),它可以转到屏幕的中心,但是空白区域(通知的左右)不能滚动。
How can I remove the annotation and keep the scrollable area? 如何删除注释并保留可滚动区域?
PS IDE Eclipse PS 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>
after removing the linear layout or relative layout 删除线性布局或相对布局后 (removed linear layout) (删除线性布局)
<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>
(removed relative layout) (删除了相对布局)
<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" />
<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>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.