HTML 파일에서 선택한 양식 필드를 프로그래밍 방식으로 LinearLayout에 추가하려고합니다. 아래쪽에 다음 버튼이 있지만 계속 화면에서 잘립니다. 나는 태블릿에서 그것을 시도하고 여전히 나타나지 않습니다.안드로이드 ScrollView가 아래쪽에서 잘림
당신이 볼 수 있듯이, 요소가 렌더링지고 있지만 마지막은 어떤 이유로 화면을 실행합니다.
조각의 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:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context=".dataInput.DataInputActivity">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
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:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="@style/AppTheme.PopupOverlay">
</android.support.v7.widget.Toolbar>
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
android:layout_margin="@dimen/fab_margin"
android:src="@android:drawable/ic_media_play" />
</android.support.design.widget.CoordinatorLayout>
내가 조각의 onCreateView
에서 만든 방법 formInflator
를 호출하고 조각에서의 LinearLayout을 통과하고하고 Elements
객체 (:
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:context=".dataInput.PropertyInfoFragment"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:paddingLeft="20dp"
android:paddingRight="20dp">
<ScrollView
android:fillViewport="true"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:id="@+id/linear_layout_property_info"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
</LinearLayout>
<Button
android:id="@+id/nextButton"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/next"
android:background="@color/colorPrimary"
android:textColor="@android:color/white"/>
</LinearLayout>
</ScrollView>
</FrameLayout>
는 활동의 XML을 호출 Jsoup 라이브러리에서) LinearLayout에 넣으려는 모든 요소가 들어 있습니다.
내가 잘못 뭐하는 거지public void formInflator(LinearLayout parentLayout, Elements formElements) {
TextInputLayout index = null;
for(Element textField : formElements) {
TextInputEditText editText = new TextInputEditText(context);
editText.setId(View.generateViewId());
editText.setHint(textField.id());
editText.setText(textField.text());
LinearLayout.LayoutParams editTextParams = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
editText.setLayoutParams(editTextParams);
TextInputLayout textInputLayout = new TextInputLayout(context);
textInputLayout.setId(View.generateViewId());
textInputLayout.setTag(textField.id());
RelativeLayout.LayoutParams textInputLayoutParams = new RelativeLayout.LayoutParams(
RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
if (index == null)
index = textInputLayout;
else
textInputLayoutParams.addRule(RelativeLayout.BELOW, index.getId());
textInputLayout.setLayoutParams(textInputLayoutParams);
textInputLayout.addView(editText, editTextParams);
parentLayout.addView(textInputLayout, textInputLayoutParams);
index = textInputLayout;
}
}
어떤 생각 :
여기 방법 formInflator
입니까?
그것이있는 ScrollView가 확실히 있다면 당신은 그냥 "차단"을 내용의 나머지 부분을보기 위해 스크롤 할 수 있습니까? 달성하고자하는 의도 된 행동은 무엇입니까? – wanpanman
@wanpanman 나는 내 질문에 제대로 말하지 않았다고 생각한다. 문제는 모든 EditText보기 후에 버튼이 있어야한다는 것입니다. 그러나 ScrollView 아래쪽으로 끝까지 스크롤하지 않습니다. 스크린 샷에 표시된 내용은 가장 먼 것입니다. – Mak
액션 바에 기분이 들었습니다. 나는 같은 문제에 직면하고있다. 나는 탭 활동을 사용하고 있고, 탭 안에는'EditText'가 있습니다. 처음에는 바닥이 OP와 똑같이 잘립니다. 하지만 일단 'EditText'를 활성화하고 소프트 키보드가 나타나면 액션 바가 사라집니다 (이것은 해결할 수없는 또 다른 문제입니다). 그러나 키보드가 제거 된 후에도'ScrollView'는 완벽하게 작동합니다 (액션 바 아직 실종 상태입니다.) – xSooDx