我的应用程序屏幕上有白色边框,如下所示:
当我更改背景颜色时,我注意到了这一行。
如何删除它?
这是我的代码。
TimeTableFragment.java
public class TimeTableFragment extends Fragment {
DBHelper dbHelper;
SQLiteDatabase db;
private static final String TAG = "TimeTableFragment";
private Context mContext;
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.activity_time_table_fragment, container, false);
return view;
}
...
}
TimeTableLayout.xml
<android.support.constraint.ConstraintLayout 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:background="@drawable/back_gradi"
tools:context=".TimeTableFragment">
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="352dp"
android:layout_height="499dp"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="8dp"
android:background="@drawable/table_back"
android:stretchColumns="1"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView">
<TableRow>
<TextView
....
@ drawble / back_gradi.xml
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:startColor="@color/back"
android:endColor="#2a3350"
android:angle="45"/>
</shape>
MainActivity.java
public class MainActivity extends AppCompatActivity {
private FragmentManager fragmentManager = getSupportFragmentManager();
private HomeFragment homeFragment = new HomeFragment();
private TimeTableFragment timeTableFragment = new TimeTableFragment();
private SettingFragment settingFragment = new SettingFragment();
Fragment active = homeFragment;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
fragmentManager.beginTransaction().add(R.id.main_container, timeTableFragment, "1").hide(timeTableFragment).commit();
fragmentManager.beginTransaction().add(R.id.main_container, settingFragment, "3").hide(settingFragment).commit();
fragmentManager.beginTransaction().add(R.id.main_container, homeFragment, "2").commit();
BottomNavigationView bottomNavigationView = (BottomNavigationView) findViewById(R.id.navigation_view);
fragmentManager.beginTransaction().add(R.id.main_container,homeFragment);
bottomNavigationView.setSelectedItemId(R.id.action_home);
// 아이템 선택 될 시
bottomNavigationView.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) {
switch (menuItem.getItemId()){
case R.id.action_home:
fragmentManager.beginTransaction().hide(active).show(homeFragment).commit();
homeFragment.paint();
active = homeFragment;
return true;
case R.id.action_timetable:
fragmentManager.beginTransaction().hide(active).show(timeTableFragment).commit();
timeTableFragment.sendData(getApplicationContext());
active = timeTableFragment;
return true;
case R.id.action_setting:
fragmentManager.beginTransaction().hide(active).show(settingFragment).commit();
active = settingFragment;
return true;
}
return false;
}
});
}
}
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<include
layout="@layout/content_main"
android:layout_width="match_parent"
android:layout_height="453dp"
android:layout_above="@+id/navigation_view"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginStart="0dp"
android:layout_marginLeft="0dp"
android:layout_marginTop="0dp"
android:layout_marginEnd="0dp"
android:layout_marginRight="0dp"
android:layout_marginBottom="0dp" />
<android.support.design.widget.BottomNavigationView
app:labelVisibilityMode="labeled"
app:itemTextColor="@android:color/holo_blue_dark"
app:itemIconTint="@android:color/holo_blue_dark"
android:id="@+id/navigation_view"
android:background="@color/back_nav"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
app:menu="@menu/bottom_navi">
</android.support.design.widget.BottomNavigationView>
</RelativeLayout>