按钮没有显示在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