У меня есть эта очень простая компоновка, 2 кнопки, флажок, стрелка и некоторый текст. В настоящее время на LinearLayout и я могу использовать только половину экрана, максимум 5-6 строк. Im пытается перетащить кнопки в buttom, но я не могу. как будто они застряли в рамке, покрывающей только верхнюю половину экрана. Любые предложения, как это решить?Проблемы с использованием всего экрана с LinearLayout
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/RelativeLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="@+id/statusText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/timerText"
android:layout_alignParentTop="true"
android:layout_marginTop="31dp"
android:text="@string/statusText"
android:textAppearance="?android:attr/textAppearanceLarge" />
<CheckBox
android:id="@+id/timerCB"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/timerTime"
android:layout_centerHorizontal="true"
android:layout_marginTop="44dp"
android:onClick="activateTimer"
android:text="@string/timerCB" />
<Button
android:id="@+id/stop_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_marginBottom="20dp"
android:onClick="stopOperation"
android:text="@string/stop_button" />
<Button
android:id="@+id/start_button"
android:layout_width="319dp"
android:layout_height="wrap_content"
android:layout_above="@+id/stop_button"
android:layout_alignParentRight="true"
android:onClick="startOperation"
android:text="@string/start_button" />
<TextView
android:id="@+id/timerText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/statusText"
android:layout_centerHorizontal="true"
android:layout_marginTop="71dp"
android:enabled="false"
android:text="@string/timerText"
android:textAppearance="?android:attr/textAppearanceLarge" />
<SeekBar
android:id="@+id/timerTime"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/timerText"
android:layout_marginTop="32dp"
android:enabled="false"
android:max="90" />
</RelativeLayout>
мой LogCat это:
02-09 17:01:41.107: E/AndroidRuntime(12469): FATAL EXCEPTION: main
02-09 17:01:41.107: E/AndroidRuntime(12469): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.remoteswitch/com.example.remoteswitch.MainActivity}: java.lang.ClassCastException: android.widget.Button cannot be cast to android.widget.CheckBox
02-09 17:01:41.107: E/AndroidRuntime(12469): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
02-09 17:01:41.107: E/AndroidRuntime(12469): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
02-09 17:01:41.107: E/AndroidRuntime(12469): at android.app.ActivityThread.access$600(ActivityThread.java:141)
02-09 17:01:41.107: E/AndroidRuntime(12469): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
02-09 17:01:41.107: E/AndroidRuntime(12469): at android.os.Handler.dispatchMessage(Handler.java:99)
02-09 17:01:41.107: E/AndroidRuntime(12469): at android.os.Looper.loop(Looper.java:137)
02-09 17:01:41.107: E/AndroidRuntime(12469): at android.app.ActivityThread.main(ActivityThread.java:5039)
02-09 17:01:41.107: E/AndroidRuntime(12469): at java.lang.reflect.Method.invokeNative(Native Method)
02-09 17:01:41.107: E/AndroidRuntime(12469): at java.lang.reflect.Method.invoke(Method.java:511)
02-09 17:01:41.107: E/AndroidRuntime(12469): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
02-09 17:01:41.107: E/AndroidRuntime(12469): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
02-09 17:01:41.107: E/AndroidRuntime(12469): at dalvik.system.NativeStart.main(Native Method)
02-09 17:01:41.107: E/AndroidRuntime(12469): Caused by: java.lang.ClassCastException: android.widget.Button cannot be cast to android.widget.CheckBox
02-09 17:01:41.107: E/AndroidRuntime(12469): at com.example.remoteswitch.MainActivity.allocatePointers(MainActivity.java:60)
02-09 17:01:41.107: E/AndroidRuntime(12469): at com.example.remoteswitch.MainActivity.onCreate(MainActivity.java:42)
02-09 17:01:41.107: E/AndroidRuntime(12469): at android.app.Activity.performCreate(Activity.java:5104)
02-09 17:01:41.107: E/AndroidRuntime(12469): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
02-09 17:01:41.107: E/AndroidRuntime(12469): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
что вам нужно сделать? – Kels
Пожалуйста, покажите свою часть кода ... –
Я добавил макет xml. Пожалуйста, совет – buddy123