[英]how remove margin from right and left of list fragment in android
i have one list fragment but i have 2 problem我有一个列表片段,但我有两个问题
1- there is margin in right and left side and list view width is not match parent 1- 左右边有边距,列表视图宽度与父级不匹配
2-scroll bar is in list view not out . 2-scroll bar is in list view not out 。
i tested these codes in main activity too but no use我也在主要活动中测试了这些代码,但没有用
ViewGroup.MarginLayoutParams layoutParams = (ViewGroup.MarginLayoutParams) getListView()
.getLayoutParams();
getListView().setScrollBarStyle(SCROLLBARS_OUTSIDE_OVERLAY );
layoutParams.setMargins(0, 0, 0, 0);
getListView().addHeaderView(headerView);
newadp = new adveradapter(getActivity(), Const.advermodel);
setListAdapter(newadp);
getListView().setOnScrollListener(this);
getListView().setDivider(null);
getListView().setDividerHeight(16);
/////// my row design code that is set in adapter is here /////// 我在适配器中设置的行设计代码在这里
<?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="wrap_content"
android:layoutDirection="ltr"
android:orientation="horizontal"
>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="2"
android:orientation="vertical">
<TextView
android:text="ksdalkdsjljsdASD"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/txtadvtitle"
android:layout_gravity="right"
android:layout_marginBottom="10dp"
android:gravity="right"
style="@style/txt15" />
<TextView
android:layout_height="wrap_content"
android:layout_gravity="right"
android:gravity="center"
android:layout_width="wrap_content"
android:id="@+id/txtadvdate"
style="@style/txt14"
/>
<TextView
android:layout_gravity="right"
android:text="dadsffaf"
android:id="@+id/txtlocation"
style="@style/txt14"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:layout_gravity="left"
android:background="@color/white"
android:padding="2dp"
android:id="@+id/txtadvrank"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<ImageView
android:background="@drawable/listviewimagedraw"
android:id="@+id/imghotel"
android:layout_margin="3dp"
android:layout_width="100dp"
android:layout_height="100dp"
android:padding="3dp"
android:scaleType="fitXY"
android:layout_gravity="center"
/>
</LinearLayout>
in main activity i have one framelayout.在主要活动中,我有一个框架布局。 then i replace it with list fragment and in adapter i create every custom row.
然后我用列表片段替换它,并在适配器中创建每个自定义行。 i checked all paddins.
我检查了所有的paddins。 but there is not any thing.
但没有任何东西。 also i set listview style in styles but no use
我也在样式中设置了列表视图样式但没有用
thanks Keyur Nimavat fro your comment.感谢 Keyur Nimavat 的评论。 exactly your right.
正是你的权利。 when i check my design code i found padding.
当我检查我的设计代码时,我发现了填充。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.