활동에서 DB의 데이터를 표시하고 있습니다. 나는 테이블과 버튼을 바닥에두고 싶다. 데이터에 대해서는 TableLayout이 최선의 선택이라고 생각했습니다. TableLayout을 HorizontalView에 추가했습니다. &이 ScrollView에 수직으로 스크롤됩니다. & 가로. 머리글을 포함하여 모든 행을 동적으로 추가합니다. 이 부분은 잘 작동합니다.Android : 원하는대로 TableLayout을 올바르게 설정할 수 없습니다.
내용이 화면 너비보다 작 으면 전체 화면 너비를 차지해야합니다. 예를 들면. 테이블이 Portrait 모드에 잘 맞으면, Landscape 모드에서 오른쪽에 공백이 생깁니다. 나는 그 공간이 비어있는 대신에 모든 칸을 차지하고 싶다. 행 너비가 화면 너비보다 크면 아무런 문제가 없습니다. 즉, 가로 스크롤 막대가 나타납니다.
몇 가지 변형을 시도했지만 아무런 도움이되지 않았습니다. 모든 공간을 utlize하기 위해 어떤 설정을 할 것인지 (어떤 경우 든 avbl) &이 표시됩니다.
그리고 예, 수평 스크롤바 1 호 이상이 마지막 행에 나타납니다. 마지막 행 아래에 이 나타나기를 원합니다 - 그래서 마지막 행의 경계가 보입니다. 내 XML :
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" android:orientation="vertical">
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:scrollbars="horizontal|vertical">
<HorizontalScrollView android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="10dp" android:layout_marginBottom="10dp" >
<TableLayout android:id="@+id/browseTable" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_marginBottom="20dp"
android:background="#FF0000" android:stretchColumns="1,2,3">
</TableLayout>
</HorizontalScrollView>
</ScrollView>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:orientation="horizontal" android:gravity="center"
android:layout_marginTop="15dp">
<Button android:id="@+id/browseAddBtn" android:text="Add" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:layout_marginRight="10dp" />
<Button android:id="@+id/browseViewBtn" android:text="Edit" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:layout_marginRight="10dp" />
<Button android:id="@+id/browseReturnBtn" android:text="Return" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" />
</LinearLayout>
</LinearLayout>
출력 :
이 이미지를 캡처하여 여기에 추가 한 다음 정확히 무엇을 원하는지 말할 수 있습니다. 그러면 다른 도움을받을 수 있습니다. :) 감사합니다 – AAnkit
@AnkitA, 내가 가지고있는 이미지를 추가하고 내가 원하는 것을 설명합니다. 다른 사람들이 나를 도울 수 있기를 바랍니다. – Tvd
내 대답을 시도해보십시오. 그렇지만 모든 문제는 해결할 수 없습니다. float 값을 표시하려는 경우 초입니다. 길이까지 보여 주려고 노력하십시오.십진수 후 4 자리를 좋아해요. – AAnkit