我使用的视频页面我有3个,我在每个页面都有这个。 我没有找到错误来获得此输出] 2
顶部有白色条纹。我找不到任何解决方法。这是我的代码:
和story.java:
import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
public class Story1Fragment extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_story1, container, false);
Button _play = (Button) rootView.findViewById(R.id.btn_play);
_play.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
}
});
return rootView;
}
}
主要布局:
<?xml version="1.0" encoding="utf-8"?>
<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"
tools:context="com.jeravare.hypralyne.MainActivity">
<android.support.v4.view.ViewPager xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/pager"
android:layout_width="368dp"
android:layout_height="495dp"
android:layout_marginTop="8dp"
app:layout_constraintTop_toTopOf="parent"
tools:layout_editor_absoluteX="8dp"></android.support.v4.view.ViewPager>
</android.support.constraint.ConstraintLayout>
答案 0 :(得分:0)
问题不在于片段布局。
你可以改变这个:
android:layout_width="368dp"
android:layout_height="495dp"
android:layout_marginTop="8dp"
到此:
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="8dp" // you can remove this if you don't need a space at the top