2017-04-25 2 views
-2

조각에서 RecyclerView를 사용하고 있습니다. 나는 조각이 부모의 폭과 높이와 일치하도록하고 싶다. 그러나 이것은 나의 결과입니다.조각에서 여백 제거

My output

단편 주위 방치하는 공간이있다. 나는 그것을 제거하고 싶다. 부모 컨테이너를 사용하여 LayoutParams를 match_parent로 변경하면서 모든 것을 시도했습니다. 세 번째 매개 변수를 false로 설정했지만 아무 것도 작동하지 않았습니다.

내 코드 : -

Fragment.xml

<?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" 
android:id="@+id/RLGEVENT" 
android:background="@color/white"> 

<android.support.design.widget.FloatingActionButton 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_gravity="bottom" 
    android:clickable="true" 
    android:layout_marginLeft="16dp" 
    android:layout_marginBottom="16dp" 
    android:layout_marginRight="16dp" 
    android:layout_alignParentBottom="true" 
    android:layout_alignParentEnd="true" 
    android:src="@drawable/postbutton" 
    android:id="@+id/floatingButton" /> 

<android.support.v7.widget.RecyclerView 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:id="@+id/listView" 
    android:layout_alignParentTop="true" 
    android:layout_alignParentLeft="true" 
    android:layout_alignParentRight="true" 

    /> 

조각

@Override 
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 


    view = inflater.inflate(R.layout.activity_gevent_main, container, false); 

    RelativeLayout rl = (RelativeLayout) view.findViewById(R.id.RLGEVENT); 
    rl.setLayoutParams(new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT)); 
    rl.invalidate(); 

    //code   

    return view; 
} 

Root.xml

<?xml version="1.0" encoding="utf-8"?> 
    <android.support.v4.widget.DrawerLayout       
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:id="@+id/drawer_layout" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:fitsSystemWindows="true" 
    tools:openDrawer="start"> 

<include 
    layout="@layout/app_bar_start" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" /> 

<android.support.design.widget.NavigationView 
    android:id="@+id/nav_view" 
    android:layout_width="wrap_content" 
    android:layout_height="match_parent" 
    android:background="@color/white" 
    android:layout_gravity="start" 
    android:fitsSystemWindows="true" 
    app:insetForeground="@color/white" 
    android:theme="@style/AppTheme.Lolwa" 
    app:headerLayout="@layout/nav_header_start" 
    app:itemTextColor="@color/black" 
    app:menu="@menu/activity_start_drawer" /> 

    </android.support.v4.widget.DrawerLayout> 

Row.xml

<RelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:id="@+id/card_view" 
    android:layout_height="wrap_content"> 

    <RelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
     android:id="@+id/gEventRowRL" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginTop="5dp" 
     android:background="#fff"> 


     <ImageView 
      android:id="@+id/exampleProfilePic" 
      android:layout_width="50dp" 
      android:layout_height="50dp" 
      android:layout_marginLeft="10dp" 
      android:scaleType="fitXY" 
      android:src="@drawable/background_profile_pic" /> 

     <ImageView 
      android:id="@+id/photoOf" 
      android:layout_width="match_parent" 
      android:layout_height="400dp" 
      android:layout_below="@+id/gEventsDetails" 
      android:scaleType="fitXY" 
      android:src="@drawable/black_total" /> 


     <TextView 
      android:id="@+id/geventTitle" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_margin="10dp" 
      android:layout_toRightOf="@+id/exampleProfilePic" 
      android:text="Title" 
      android:textSize="18sp" 

      /> 

     <TextView 
      android:id="@+id/gEventsDetails" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_alignParentLeft="true" 
      android:layout_below="@+id/exampleProfilePic" 
      android:layout_margin="10dp" 
      android:text="" 
      android:textSize="16sp" /> 


     <TextView 
      android:id="@+id/gEventsDescription" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_below="@+id/geventTitle" 
      android:layout_margin="10dp" 
      android:layout_toRightOf="@+id/photoOf" 
      android:text="" /> 


    </RelativeLayout> 

    </RelativeLayout> 

app_bar_start.xml

<?xml version="1.0" encoding="utf-8"?> 
    <android.support.design.widget.CoordinatorLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:fitsSystemWindows="true" 
    tools:context="com.example.anubhavr.firebase.StartActivity"> 

    <android.support.design.widget.AppBarLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:theme="@style/AppTheme.AppBarOverlay"> 

    <android.support.v7.widget.Toolbar 
     android:id="@+id/toolbar" 
     android:layout_width="match_parent" 
     android:layout_height="?attr/actionBarSize" 
     android:background="?attr/colorPrimary" 
     app:popupTheme="@style/AppTheme.PopupOverlay" /> 

    </android.support.design.widget.AppBarLayout> 

    <include layout="@layout/content_start" /> 


</android.support.design.widget.CoordinatorLayout> 

활동

@Override 
    protected void onCreate(Bundle savedInstanceState) { 

    setTheme(R.style.AppTheme); 

    super.onCreate(savedInstanceState); 
    overridePendingTransition(R.anim.slide_in, R.anim.slide_out); 

    setContentView(R.layout.activity_start); 

    fragmentManager = getSupportFragmentManager(); 
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); 
    setSupportActionBar(toolbar); 

    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); 
    ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
      this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); 
    drawer.setDrawerListener(toggle); 
    toggle.syncState(); 

    NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); 
    navigationView.setNavigationItemSelectedListener(this); 


    com.example.anubhavr.firebase.Global_Events.MainActivity mainActivity = new com.example.anubhavr.firebase.Global_Events.MainActivity(); 
    setListener(mainActivity); 

    fragmentManager.beginTransaction().replace(R.id.nav_home, mainActivity, mainActivity.getTag()).commit(); 


} 
+0

포스트 루트 레이아웃이 조각이 추가되고 있음을 에. – azizbekian

+0

또한 리사이클 뷰 –

+0

의 행을 게시하십시오. 또한'app_bar_start.xml'을 게시하십시오. – azizbekian

답변

1

패딩은 content_start에 있어야

+0

리소스 파일에 패딩이 적용되어 있지 않습니다. 어떤 패딩을 사용하고 있습니까? – THGRoy

+0

내에 app_bart_start가 있습니다. content_start가 xml 레이아웃이므로, 귀하의 질문에 그것을 볼 수 없습니다. 아마도 놓칠 수 있습니다. 하지만 당신의 단편은 그 안에 있어야한다고 봅니다. – cutiko