按钮没有显示在Android应用程序中 [英] Button not showing in android app

查看:84
本文介绍了按钮没有显示在Android应用程序中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我在相对布局内的android studio中的应用程序中创建了六个按钮。按钮在Android工作室的预览模式下显示OK,但是当我安装我的应用程序以在手机或模拟器上进行测试时,它们的最后一个没有显示。可能是什么问题

这是我的代码

Hello I have created six buttons in an app in android studio inside the Relative Layout. The buttons show OK in the preview mode of android studio but they second last one does not show when I install my app to test on a phone or an emulator. What could be the problem
Here is my code

    <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="wrap_content" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" tools:context="com.example.nelson.kuzaapp.MainActivity">

        <imageview android:layout_width="match_parent" android:layout_height="match_parent" android:src="@drawable/logoo" android:contentdescription="@string/logo" android:id="@+id/logo" android:layout_margintop="-500dp">
       <!--Make query button-->
        <Button

            style="?android:textAppearanceSmall"

            android:layout_width="match_parent"

            android:layout_height="wrap_content"

            android:layout_marginTop="150dp"

            android:text="@string/make_farming_query"

            android:id="@+id/buttonAskExpert"

            android:layout_below="@+id/logo"

            android:layout_alignParentTop="true"

            android:layout_alignParentRight="true"

            android:layout_alignParentEnd="true"

            />
        <!--View products Button-->
        <Button

            style="?android:textAppearanceSmall"

            android:layout_width="match_parent"

            android:layout_height="wrap_content"

            android:layout_marginTop="16dp"

            android:text="@string/view_products"

            android:id="@+id/buttonViewProducts"

            android:layout_below="@+id/buttonAskExpert"

            android:layout_alignLeft="@+id/buttonAskExpert"

            android:layout_alignStart="@+id/buttonAskExpert"

            />
<!--Farmer Login button-->
        <Button

            style="?android:textAppearanceSmall"

            android:layout_width="match_parent"

            android:layout_height="wrap_content"

            android:layout_marginTop="16dp"

            android:text="@string/farmer_login"

            android:id="@+id/buttonFarmerLogin"

            android:layout_below="@+id/buttonViewProducts"

            android:layout_alignLeft="@+id/buttonViewProducts"

            android:layout_alignStart="@+id/buttonViewProducts" />
<!--Farmer registration-->
        <Button

            style="?android:textAppearanceSmall"

            android:layout_width="match_parent"

            android:layout_height="wrap_content"

            android:layout_marginTop="16dp"

            android:text="@string/farmer_registration"

            android:id="@+id/buttonRegisterFarmer"

            android:layout_below="@+id/buttonFarmerLogin"

            android:layout_alignLeft="@+id/buttonFarmerLogin"

            android:layout_alignStart="@+id/buttonFarmerLogin" />
<!-- Twitter button-->
        <Button

            style="?android:textAppearanceSmall"

            android:layout_width="match_parent"

            android:layout_height="wrap_content"

            android:layout_marginTop="16dp"

            android:text="@string/follow_us_on_twitter"

            android:id="@+id/buttonFollowTwitter"

            android:layout_below="@+id/buttonRegisterFarmer"

            android:layout_alignLeft="@+id/buttonRegisterFarmer"

            android:layout_alignStart="@+id/buttonRegisterFarmer" />
<!--Facebook button-->
        <Button

            style="?android:textAppearanceSmall"

            android:layout_width="match_parent"

            android:layout_height="wrap_content"

            android:layout_marginTop="16dp"

            android:text="@string/like_us_on_facebook"

            android:id="@+id/buttonLikeFacebook"

            android:layout_below="@+id/buttonFollowTwitter"

            android:layout_alignLeft="@+id/buttonFollowTwitter"

            android:layout_alignStart="@+id/buttonFollowTwitter" />


    





What I have tried:



I have tried to add a Scroll View before the Relative Layout and even changing the width and height sizes to be the same



What I have tried:

I have tried to add a Scroll View before the Relative Layout and even changing the width and height sizes to be the same

推荐答案

I have realized that the hidden buttons have an app installed listener configured to check if the app is instaled in order to display the button. And since tweeter is not installed, the tweeter button disappears
I have realized that the hidden buttons have an app installed listener configured to check if the app is instaled in order to display the button. And since tweeter is not installed, the tweeter button disappears


这篇关于按钮没有显示在Android应用程序中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆