私は自分のアプリでナビゲーションドロワーのアクティビティを持っており、そこにいくつかのフラグメントがあります。私はScrollviewを持っているし、その中にラジオボタングループがあります。ラジオボタンは、データベースから取得するデータから動的に追加されます。問題scrollviewアプリ の上部に2つのラジオボタンを隠している。これは、xmlファイルですスクロールビュー上部のラジオボタンが表示されない
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.nimesha.delivery.Curjob_fragment">
<Button
android:id="@+id/naviBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Navigate"
android:layout_marginRight="18dp"
android:layout_marginEnd="18dp"
android:layout_marginBottom="18dp"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
<Button
android:id="@+id/signoutbtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="52dp"
android:layout_marginStart="52dp"
android:text="Button"
android:layout_below="@+id/scrollView2"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<ScrollView
android:id="@+id/scrollView2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/naviBtn"
android:layout_marginTop="@dimen/nav_header_vertical_spacing"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:clipToPadding="true"
android:fillViewport="true"
android:layout_weight="1">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RadioGroup
android:id="@+id/radioGrp"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>
</ScrollView>
</RelativeLayout>
これは、私はそこにすべきラジオボタングループ
for (DataSnapshot jobSnap: dataSnapshot.getChildren()) {
String key = jobSnap.getKey();
Double lat = jobSnap.child("lat").getValue(Double.TYPE);
Double longi =jobSnap.child("long").getValue(Double.TYPE);
Log.d(TAG, key + " " + lat + " " + longi);
RadioButton radioButton = new RadioButton(getActivity());
radioButton.setLayoutParams
(new RadioGroup.LayoutParams
(RadioGroup.LayoutParams.WRAP_CONTENT, RadioGroup.LayoutParams.WRAP_CONTENT));
radioButton.setText("Radio Button #" + lat);
radioButton.setId(count);
//add it to the group.
radiogroup.addView(radioButton, count);
count += 1 ;
}
https://i.stack.imgur.com/26Qfj.jpg
を移入する方法であります上にラジオボタンがいくつかあります
彼らが隠されている、またはグループに追加されませんか? –
それらは追加されますが、ボタンのいくつかはアクティビティタイトルバーの後ろに配置されます –