Cant add border to Button using XML [duplicate] - android

This question already has answers here:
Rounded corners on material button
(8 answers)
Closed 4 years ago.
I just wanted to add a broder to my Button but its not working.
Main xml script:
button_style4.xml:
The Button appears normaly in the App and it works as I want it to work just the border is not appearing...
Someone find the fault?

<Button
android:id="#+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:background="#drawable/button_border"
android:text="Example"
android:textColor="#color/black"
style="#style/Theme.AppCompat.NoActionBar"
/>

Related

is there anyway to change background image (not color) of button from xml in android studio 4.2.2? [duplicate]

This question already has answers here:
Android button background is taking the primary color
(6 answers)
Closed 1 year ago.
I am using android studio 4.2.2
when I try to change button background image with xml.
my code is below
<Button
android:id="#+id/btn_ok"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="#drawable/btn_background"
android:text="#string/ok"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="#+id/btn_cancel"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintWidth_percent="0.3" />
this was working for the previous version of android studio.
but now the buttons's background is always purple.
any additional setting needed?
Try this code
<androidx.appcompat.widget.AppCompatButton
android:id="#+id/btn_ok"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="#drawable/btn_background"
android:text="#string/ok"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="#+id/btn_cancel"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintWidth_percent="0.3"/>

scrollbars="vertical" is not working in TextView [duplicate]

This question already has answers here:
Making TextView scrollable on Android
(32 answers)
Closed 4 years ago.
Scrollbar is showing but not working or scrolling as shown in image below
XML:
<TextView
android:id="#+id/text_view_dialog_notes"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="7dp"
android:layout_marginRight="7dp"
android:hint="#string/rv_notes_content"
android:padding="5dp"
android:scrollbars="vertical"
android:minLines="10"
android:maxLines="10"
android:textSize="17sp" />
Where is something wrong and how to fix it?
Using scrollbar on textView
you have to add this line in java
textView.setMovementMethod(new ScrollingMovementMethod());
make sure you add that to your code:
yourTextView.setMovementMethod(new ScrollingMovementMethod());

how we can design imageView in corner of textView in android? [duplicate]

This question already has answers here:
How to layout text to flow around an image
(9 answers)
Closed 6 years ago.
I am new in android so I am confuse in this design so please help me.
I want to design this type
Have you tried FlowTextView
How to use
Add to your XML layout with your child views inside it:
<uk.co.deanwild.flowtextview.FlowTextView
android:id="#+id/ftv"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:padding="10dip"
android:src="#drawable/android"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginTop="400dip"
android:padding="10dip"
android:src="#drawable/android2"/>
</uk.co.deanwild.flowtextview.FlowTextView>
Then in your code:
FlowTextView flowTextView = (FlowTextView) findViewById(R.id.ftv);
Spanned html = Html.fromHtml("<html>Your html goes here....");
flowTextView.setText(html);
Add the dependency:
compile 'uk.co.deanwild:flowtextview:2.0.2'
Output:
Enjoy...

Android EditText with icon and vertical line [duplicate]

This question already has answers here:
Android EditText draw a divider line between its drawable and its text
(4 answers)
Closed 6 years ago.
I need an EditText exactly like this:
EditText with icon and vertical line
Is it possible doing this at Android XML file?
Maybe this code helps you
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/edit_text_selector">
<EditText
android:id="#+id/input"
android:layout_marginLeft="-10dp"
android:layout_toRightOf="#+id/your_icon"
android:text=""
android:padding="10dp"
android:background=""
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<!-- icon -->
<ImageView
android:padding="3dp"
android:id="#+id/icon"
android:src="#drawable/perm_group_personal_info"
android:layout_width="40dp"
android:layout_height="40dp" />
</RelativeLayout>
Yes.
Use FrameLayout / RelativeLayout.
either way you can position imageButton with the image as src and costume drawable that will have only 1 side line.

How to scroll text Horizontally in textview in android [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Horizontal scrolling text in Android
<TextView
android:id="#+id/dtitle"
android:layout_marginLeft="100dp"
android:text="Title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scrollHorizontally="true"
/>
This is my code in xml file
Do you mean like a marquee?

Categories

Resources