Ich bin ziemlich neu in Android-App-Entwicklung und ich habe in ein kleines Problem geraten.LinearLayout drängen TextView aus dem Bildschirm
Ich habe ein Linearlayout mit 2 ImageButtons in ihm und einem anderen Linearlayout mit einem Textview auf der Oberseite, wie Sie hier sehen können -
Allerdings habe ich versucht, einen anderen Linearlayout hinzufügen mehr Dinge hinzufügen in, aber es beginnt meine Begrüßungsnachricht aus dem Bildschirm
I add another LinearLayout and this happens
Hier ist der XML für den Bildschirm zu schieben
<?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"
android:layout_weight="0.6"
android:id="@+id/layout_home">
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/scrollView"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="vertical"
android:paddingLeft="0dp"
android:paddingRight="0dp"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:measureWithLargestChild="false"
android:longClickable="false">
<TextView
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Welcome"
android:id="@+id/textView4"
android:textSize="60dp"
android:layout_weight="1"
android:layout_gravity="top"/>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="56dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:background="#5cfca1">
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:paddingRight="5dp">
<ImageButton
android:id="@+id/whatisit"
android:layout_width="fill_parent"
android:layout_height="100dp"
android:layout_weight="0.5"/>
<ImageButton
android:id="@+id/contact"
android:layout_width="fill_parent"
android:layout_height="100dp"
android:layout_weight="0.5"/>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingRight="5dp"
android:paddingLeft="5dp"
android:paddingBottom="300dp">
<ImageButton
android:id="@+id/howcanitreatit"
android:layout_width="fill_parent"
android:layout_height="100dp"
android:layout_weight="0.5"/>
<ImageButton
android:id="@+id/disclaimer"
android:layout_width="fill_parent"
android:layout_height="100dp"
android:layout_weight="0.5"
android:adjustViewBounds="false"/>
</LinearLayout>
</LinearLayout>
</ScrollView>
Editiert: styles.xml
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
ich bei anderen Fragen haben gesucht, aber sie haben schien viel anders in Bezug auf Festlegung ihrer Layout zu tun und haben viel mehr Elemente und so.
Warum drückt es die Willkommensnachricht aus? Was mache ich hier falsch?
Auch fühlen Sie sich frei, alles zu hinterfragen. Je mehr Fehler, die ich gemacht habe, desto besser
warum hinzufügen layout weight? –
Datei 'style.xml' hochladen. –
@ZeeshanShabbir Die layout_weight auf den ImageButtons soll sie teilen. Alles andere ist wahrscheinlich ein Fehler beim Experimentieren – JPanda