나는 그것이 작은 일이라는 것을 알고 있지만 왜 작동하지 않는지 모르겠습니다.
사용자 정의 드로어 블 이미지를 넣을 때 작동하지 않습니다. 모서리 (획)가있는 투명한 배경 버튼을 갖고 싶습니다.
아래는 이미지입니다.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/welcome"
tools:context=".MainActivity">
<ImageView
android:id="@+id/app_logo"
android:layout_width="300dp"
android:layout_height="100dp"
android:layout_centerHorizontal="true"
android:layout_marginTop="60dp"
android:src="@drawable/applogo"/>
<TextView
android:id="@+id/app_slogan"
android:layout_width="220dp"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentTop="true"
android:layout_marginEnd="80dp"
android:layout_marginTop="140dp"
android:text="Find, Discover, Choose and buy anything online"
android:textAlignment="center"
android:textSize="22sp"
android:textStyle="bold|italic"
android:textColor="@color/design_default_color_primary"
/>
<Button
android:id="@+id/main_login_btn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
android:layout_marginBottom="10dp"
android:layout_marginStart="15dp"
android:layout_marginEnd="15dp"
android:background="@drawable/buttons"
android:padding="20dp"
android:textAllCaps="false"
android:textSize="18sp"
android:text="Already have a account ? Login"
android:textColor="@android:color/white"
/>
<Button
android:id="@+id/main_join_now_btn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_above="@id/main_login_btn"
android:layout_marginStart="15dp"
android:layout_marginEnd="15dp"
android:background="@drawable/input_design"
android:padding="20dp"
android:textAllCaps="false"
android:textSize="18sp"
android:text="Already have a account ? Login"
android:textColor="@android:color/white"
/>
</RelativeLayout>
// 드로어 블 리소스 파일.
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<stroke
android:color="#fff"
android:width="3dp"
/>
<corners
android:radius="15dp"
/>
로그인 버튼의 배경은 input_design.xml이어야하지만 왜 작동하지 않는지 모르겠습니다. 도와주세요 미리 감사드립니다.
- 답변 # 1
관련 자료
- Android Studio 4.1 이후 Android Background Drawable이 버튼에서 작동하지 않음
- ios - 사용자 정의 UIButton 배경색이 작동하지 않음
- sql - Postgresql에서 작동하지 않는 현재 날짜 및 사용자 지정 시간으로 쿼리 업데이트
- python - 파일 관리자가 Android kivymd에서 작동하지 않는 이유는 무엇입니까?
- html - nextjs의 div에 배경 이미지 설정이 작동하지 않음
- image - WhatsApp에서 데이터 공유가 Android 11에서 작동하지 않음
- drupal - 일부 #states는 사용자 정의 필드에서 작동하지 않지만 동일한 웹 양식 필드에서 작동합니다
- Flutter Android에서 사용자 정의보기를 실제 시작 화면으로 설정하는 방법
- Android 실제 기기에서 Firebase 전화 인증이 작동하지 않습니다.
- java - Android에서 "Working of onBindViewHolder"와 혼동
- 백엔드 서버 및 앱을 NET Core 31 signalR로 마이그레이션 한 후 SignalR이 XamarinForms Android 앱에서 작동을 중지합니다
- wpf - 사용자 지정 제어 라이브러리에서 리소스 사전을 사용하는 방법은 무엇입니까?
- 백그라운드 스레드에서 Android 라이브 데이터 변환
- java - Android 스튜디오에서보기의 배경색 설정
- 조각의 목록을 Android의 사용자 지정 뷰 클래스로 보내는 방법은 무엇입니까?
- Android 60 이하에서 SVG 배경 충돌이있는보기
- drupal - managed_file 사용자 정의 양식 필드의 #ajax가 작동하지 않습니다
- Android 사용자 정의 대화 상자에 키보드가 나타나지 않습니다
- knockout.js - jquery 버전을 21에서 3으로 업그레이드 한 후 녹아웃 유효성 검사 사용자 지정 규칙이 작동하지 않습니다
버튼에서 투명한 배경을 얻으려면 아마도 Widget.MaterialComponents.Button.OutlinedButton을 사용하십시오.
이 줄이 필요합니다.build.gradle(아직없는 경우) :
버튼은 다음과 같이 표시됩니다.
주의:
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
android:textColor="@color/white"
app:cornerRadius="15dp"
app:rippleColor="@color/white"
app:strokeColor="@color/white"
app:strokeWidth="3dp"
그러면 다음이 생성됩니다.