부모 레이아웃에 android:fitsSystemWindows="true"
이 포함되어 있으면 뷰 관련 작업이 발생할 때 내 BottomSheets 위치 지정을 방해한다는 것을 알게되었습니다. 안드로이드 : fitsSystemWindows와 개행을 방해하는 bottomSheets
줄 바꿈 + fitsSystemWindows = 내가 버튼, 텍스트 뷰와 bottomsheet에 이르기까지 모든 관련이없는 물건을 제거 아래로 내 bottomsheet
밀 친다.
- Button2를 : 마법 마자
android:fitsSystemWindows="true"
을 제거 로
를 발생, 모든 확인, 더 이상 이상한 행동 어디 setText("1\n2")
입니다,하지만 난 시스템에 어떻게 fitsSystemWindows 색상의 효과를 잃을/notif-bar.
나는 또한 나의 bottomSheet이 android:fitsSystemWindows="false"
자신의 레이아웃 주려고 노력하지만 아무런 영향을 미치지 않았다.
어떻게 모두 fitsSystemWindows을 달성 할 수있다 = 사실 내 bottomSheets에이 이상한 오프셋 행동하지?
public class Test extends AppCompatActivity {
private BottomSheetBehavior bottomSheetBehavior;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.act_test);
LinearLayout bottomSheet = (LinearLayout) findViewById(R.id.root_btmsheet);
bottomSheetBehavior = BottomSheetBehavior.from(bottomSheet);
bottomSheet.post(new Runnable() {
@Override
public void run() {
bottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
}
});
((Button) findViewById(R.id.btn1)).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
((TextView) findViewById(R.id.info1)).setText("1");
}
});
((Button) findViewById(R.id.btn2)).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// the culprit, Mr. Newline
((TextView) findViewById(R.id.info1)).setText("1\n2");
}
});
}
}
act_test.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true" <-- the other culprit, Ms. Fits
tools:context=".Test">
<!--<include layout="@layout/act_test_content" />-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:orientation="vertical"
android:id="@+id/root_content">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:id="@+id/btn1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="1" />
<Button
android:id="@+id/btn2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="2" />
</LinearLayout>
<TextView
android:id="@+id/info1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#e0e0e0" />
</LinearLayout>
<!--<include layout="@layout/act_test_btmsheet" />-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="200dp"
app:layout_behavior="@string/bottom_sheet_behavior"
android:orientation="vertical"
app:behavior_hideable="false"
app:behavior_peekHeight="50dp"
android:background="#5533b5e5"
android:id="@+id/root_btmsheet">
</LinearLayout>
</android.support.design.widget.CoordinatorLayout>
에 대한 레이아웃 변경 후 정상적으로 작동하고, 문제는 이제 사라질 것으로 보인다. – TWL
은 https://code.google.com/p/android/issues/detail에 23.3.0 https://developer.android.com/topic/libraries/support-library/revisions.html 링크에서 문제를 발견 ? id = 203057 – TWL