admin管理员组文章数量:1122832
I want to make a two-screen application. I want to switch from the first location notification screen to the main activity with a button but the application does not open.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android=";
xmlns:tools=";
package="com.hadi.ezanvakti">
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
<uses-feature android:name="android.hardware.sensor.accelerometer" />
<uses-feature android:name="android.hardware.sensorpass" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:supportsRtl="true">
<activity
android:name=".SplashActivity"
android:label="@string/app_name"
android:exported="true"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity" />
</application>
</manifest>
(the first screen is not a splash screen, just the name is like that)
SplashActivity.java is here:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
tikla1 =(Button) findViewById(R.id.tikla);
kapat1 =(Button) findViewById(R.id.kapat);
text1 =(TextView) findViewById(R.id.baslik);
text2 =(TextView) findViewById(R.id.text1);
text3 =(TextView) findViewById(R.id.text2);
image1 =(ImageView) findViewById(R.id.konumresmi);
checkLocationPermission();
tikla1.setOnClickListener(new View.OnClickListener() {
public void onClick(View d) {
Intent myIntent = new Intent(android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS);
startActivity(myIntent);
Intent intent = new Intent(SplashActivity.this, MainActivity.class);
startActivity(intent);
}
});
kapat1.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Intent intent = new Intent(SplashActivity.this, MainActivity.class);
startActivity(intent);
}
});
}
activity_splash.xml file is here:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android=";
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/konumi">
<TextView
android:id="@+id/baslik"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Konumunuzu kullanın"
android:textSize="60sp"
android:layout_gravity="center_horizontal"
android:textStyle="bold"
android:layout_marginTop="50dp"/>
<TextView
android:id="@+id/text1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Değişen konumunuza göre otomatik olarak güncellenen namaz vakitleri için Ezan Vakti'nin konumunuzu her zaman kullanmasına izin verin."
android:textSize="20sp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="50dp"/>
<TextView
android:id="@+id/text2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Ezan Vakti namaz vakitlerini ve kıble yönünü göstermek için arka plandaki konumu kullanacak."
android:textSize="20sp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="70dp"/>
<ImageView
android:id="@+id/konumresmi"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/konumi"
android:layout_gravity="center"
android:adjustViewBounds="true"
android:scaleType="centerCrop"
android:layout_centerInParent="true"/>
<Button
android:id="@+id/tikla"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="200dp"
android:layout_marginBottom="45dp"
android:text="Konumu aç"
android:background="#0009ff"
android:textColor="#ffffff"
android:textSize="15sp"
android:textStyle="bold"/>
<Button
android:id="@+id/kapat"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="50dp"
android:layout_marginBottom="45dp"
android:text="Hayir,tesekkurler"
android:background="#ffffff"
android:textColor="#0009ff"
android:textSize="15sp"
android:textStyle="bold"/>
</RelativeLayout>
I tried to switch to the second screen with a button from the first screen, but the application does not open.
I would be glad if you could help me.
I want to make a two-screen application. I want to switch from the first location notification screen to the main activity with a button but the application does not open.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.hadi.ezanvakti">
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
<uses-feature android:name="android.hardware.sensor.accelerometer" />
<uses-feature android:name="android.hardware.sensor.compass" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:supportsRtl="true">
<activity
android:name=".SplashActivity"
android:label="@string/app_name"
android:exported="true"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity" />
</application>
</manifest>
(the first screen is not a splash screen, just the name is like that)
SplashActivity.java is here:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
tikla1 =(Button) findViewById(R.id.tikla);
kapat1 =(Button) findViewById(R.id.kapat);
text1 =(TextView) findViewById(R.id.baslik);
text2 =(TextView) findViewById(R.id.text1);
text3 =(TextView) findViewById(R.id.text2);
image1 =(ImageView) findViewById(R.id.konumresmi);
checkLocationPermission();
tikla1.setOnClickListener(new View.OnClickListener() {
public void onClick(View d) {
Intent myIntent = new Intent(android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS);
startActivity(myIntent);
Intent intent = new Intent(SplashActivity.this, MainActivity.class);
startActivity(intent);
}
});
kapat1.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Intent intent = new Intent(SplashActivity.this, MainActivity.class);
startActivity(intent);
}
});
}
activity_splash.xml file is here:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/konumi">
<TextView
android:id="@+id/baslik"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Konumunuzu kullanın"
android:textSize="60sp"
android:layout_gravity="center_horizontal"
android:textStyle="bold"
android:layout_marginTop="50dp"/>
<TextView
android:id="@+id/text1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Değişen konumunuza göre otomatik olarak güncellenen namaz vakitleri için Ezan Vakti'nin konumunuzu her zaman kullanmasına izin verin."
android:textSize="20sp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="50dp"/>
<TextView
android:id="@+id/text2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Ezan Vakti namaz vakitlerini ve kıble yönünü göstermek için arka plandaki konumu kullanacak."
android:textSize="20sp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="70dp"/>
<ImageView
android:id="@+id/konumresmi"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/konumi"
android:layout_gravity="center"
android:adjustViewBounds="true"
android:scaleType="centerCrop"
android:layout_centerInParent="true"/>
<Button
android:id="@+id/tikla"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="200dp"
android:layout_marginBottom="45dp"
android:text="Konumu aç"
android:background="#0009ff"
android:textColor="#ffffff"
android:textSize="15sp"
android:textStyle="bold"/>
<Button
android:id="@+id/kapat"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="50dp"
android:layout_marginBottom="45dp"
android:text="Hayir,tesekkurler"
android:background="#ffffff"
android:textColor="#0009ff"
android:textSize="15sp"
android:textStyle="bold"/>
</RelativeLayout>
I tried to switch to the second screen with a button from the first screen, but the application does not open.
I would be glad if you could help me.
Share Improve this question asked Nov 21, 2024 at 17:49 Taha KaraTaha Kara 12 bronze badges 01 Answer
Reset to default 0Your issue is in activity_splash.xml
. The layout_width
and layout_height
attributes of your TextView
and ImageView
are set to match_parent
. This means these components overlap your Button
and make them unclickable.
Adjust your layout and avoid using match_parent
for your TextView
and ImageView
. You should change its layout_width
and layout_height
to wrap_content
combined with adjusting other attributes to get the expected layout.
For example:
<TextView
android:id="@+id/baslik"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Konumunuzu kullanın"
android:textSize="60sp"
android:layout_gravity="center_horizontal"
android:textStyle="bold"
android:layout_marginTop="50dp"/>
<TextView
android:id="@+id/text1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Değişen konumunuza göre otomatik olarak güncellenen namaz vakitleri için Ezan Vakti'nin konumunuzu her zaman kullanmasına izin verin."
android:textSize="20sp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="50dp"/>
<TextView
android:id="@+id/text2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Ezan Vakti namaz vakitlerini ve kıble yönünü göstermek için arka plandaki konumu kullanacak."
android:textSize="20sp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="70dp"/>
<ImageView
android:id="@+id/konumresmi"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/konumi"
android:layout_gravity="center"
android:adjustViewBounds="true"
android:scaleType="centerCrop"
android:layout_centerInParent="true"/>
本文标签: javaWhen I make the splash screen the main screenthe app does not openStack Overflow
版权声明:本文标题:java - When I make the splash screen the main screen, the app does not open - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736308273a1933600.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论