최근에 로컬 블루투스 장치를 표시하기 위해 목록보기를 추가하려고했습니다.툴바 배경 누락 및 이동 ListView (Android)를 추가 한 후 제목
은 (이미지 참조)
는렌더링 이미지 도구 모음의 배경이 보이지 않는,
따라서 잘 보이는 (목록보기 뒤에 추정)와 제목 아래로 이동 그 페이지. 또한 툴바에 '스캔'과 '새로 고침'이라는 레이블이 붙은 두 개의 버튼이 있습니다.이 버튼은 현재 목록보기 위치에서 작동하지만 테이블 상단에 위치 시키면 표시되지만 작동하지 않습니다.
내가
전화
에 응용 프로그램의 AppCompatActivity스크린 샷을 확장하고 그 문제는 목록보기를 구현 한 이후 약왔다으로 문제가 주요 레이아웃에 믿습니다.
저는 Android가 처음인데 이것은 내 첫 번째 게시물 중 하나입니다. 어떤 추가 코드라도 알려주세요 !!
미리 감사드립니다.
주요 활동의 XML
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<android.support.v7.widget.Toolbar
android:id="@+id/tool_bar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorBackground"
/>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:stretchColumns="*"
android:weightSum="1">
<TextView
android:padding="@dimen/activity_horizontal_margin"
android:gravity="center_horizontal"
android:textSize="20sp"
android:text="Local Environmental Parameters"/>
<TableRow>
<TextView
android:layout_column="0"
android:textSize="15sp"
android:gravity="center_horizontal"
android:text="Ambient Temperature"/>
<TextView
android:layout_column="2"
android:textSize="15sp"
android:gravity="center_horizontal"
android:text="Barometric Pressure"
android:layout_marginBottom="25dp"/>
</TableRow>
<TableRow>
<TextView
android:id="@+id/rd_temp"
android:layout_column="0"
android:textSize="15sp"
android:gravity="center_horizontal"/>
<TextView
android:layout_column="2"
android:id="@+id/rd_pressure"
android:textSize="15sp"
android:gravity="center_horizontal"
android:layout_marginBottom="50dp"/>
</TableRow>
<TableRow>
<TextView
android:layout_column="0"
android:textSize="15sp"
android:gravity="center_horizontal"
android:text="Ambient Light"
android:id="@+id/textView" />
<TextView
android:layout_column="2"
android:textSize="15sp"
android:gravity="center_horizontal"
android:text="Humidity"
android:layout_marginBottom="25dp"/>
</TableRow>
<TableRow>
<TextView
android:id="@+id/rd_light"
android:layout_column="0"
android:textSize="15sp"
android:gravity="center_horizontal"/>
<TextView
android:id="@+id/rd_humidity"
android:layout_column="2"
android:textSize="15sp"
android:gravity="center_horizontal"/>
</TableRow>
<ListView
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="120dp" />
</TableLayout>
</RelativeLayout>
도구 모음 XML
<android.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorPrimary"
android:elevation="4dp"
android:id="@+id/tool_bar">
</android.support.v7.widget.Toolbar>
주요 활동에서 onCreate()
protected void onCreate (Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_scan);
...
Toolbar vToolbar = (Toolbar) findViewById(R.id.tool_bar);
setSupportActionBar(vToolbar);
// Initialise list view adapter
ListView vListView = (ListView) findViewById(R.id.list);
vLeDeviceListAdapter = new LeDeviceListAdapter();
vListView.setAdapter(vLeDeviceListAdapter);
}
이미 첫 번째 솔루션을 n 개로 시도했습니다. 행운을 빌어 요,하지만 두 번째 것이 효과가 있습니다! 실수로 툴바 배경색을 흰색으로 설정했기 때문에 실제로 볼 수 없었습니다. - 고맙습니다!! – Cizzle