android-layout

Android: How to make Layout clickable when EditText is a child

ぐ巨炮叔叔 提交于 2021-02-07 09:40:08
问题 I have a Relative Layout with an EditText and an ImageView inside it. Under certain circumstances, I would like to make the whole layout clickable and not any of its children. I added an OnClickListener on the layout. And I tried the following with the children: 1. setEnabled(false) 2. setClickable(false) This works for the ImageView but even after the above changes, when I click on the area near the EditText, the keyboard comes up and I can see the cursor in the edit text. Instead of that, I

Android: How to make Layout clickable when EditText is a child

风格不统一 提交于 2021-02-07 09:36:27
问题 I have a Relative Layout with an EditText and an ImageView inside it. Under certain circumstances, I would like to make the whole layout clickable and not any of its children. I added an OnClickListener on the layout. And I tried the following with the children: 1. setEnabled(false) 2. setClickable(false) This works for the ImageView but even after the above changes, when I click on the area near the EditText, the keyboard comes up and I can see the cursor in the edit text. Instead of that, I

How to Stop Android webView swipeToRefresh loading progressbar?

帅比萌擦擦* 提交于 2021-02-07 09:19:07
问题 Note: This question was already asked here. which did not get any answer so I decided to repost it with my code. I want a webView to refresh the current page when a user pulls down the screen from the top which is working fine. The problem is the loading progress bar isn't stopping after the page has been loaded. Here's the MainActivity.java // Swipe to Refresh SwipeRefreshLayout swipeLayout = (SwipeRefreshLayout)this.findViewById(R.id.swipeToRefresh); swipeLayout.setOnRefreshListener(new

Item in RecyclerView not aligning as expected

眉间皱痕 提交于 2021-02-07 08:47:15
问题 My app has a chat activity which contains a recyclerview. This recyclerview contains two items that display the messages received by the user and the messages sent by the user. The messages received by the user is aligning from the left of the recyclerview as expected but the messages sent by the user is not aligning from the right of the recyclerview as expected. This is how it looks right now: The blue colored messages are the messages received and the gray colored messages are the messages

Item in RecyclerView not aligning as expected

為{幸葍}努か 提交于 2021-02-07 08:43:28
问题 My app has a chat activity which contains a recyclerview. This recyclerview contains two items that display the messages received by the user and the messages sent by the user. The messages received by the user is aligning from the left of the recyclerview as expected but the messages sent by the user is not aligning from the right of the recyclerview as expected. This is how it looks right now: The blue colored messages are the messages received and the gray colored messages are the messages

Common Progress bar in every activity Android

﹥>﹥吖頭↗ 提交于 2021-02-07 08:27:51
问题 I have modify the solution. I am able to get the progress bar but the progress bar never gets hide Here is class to create a progress bar with relative layout public class ProgressBarHandler { private ProgressBar mProgressBar; private Context mContext; private View _baseView; private View _hideView; public ProgressBarHandler(Context context,View baseView, View hideView) { mContext = context; _baseView = baseView; _hideView = hideView; ViewGroup layout = (ViewGroup) _baseView;//((Activity)

How to keep fixed aspect ratio for a button in android

旧城冷巷雨未停 提交于 2021-02-07 07:02:50
问题 I have a set of buttons in a horizontal layout. I have set an image drawable as the background for each of these buttons. But when I make the linear layout to span the width of the screen, the buttons lose their aspect ratio. I want to keep its aspect ratio as is. I mean I have to keep it square shaped through out the application what ever the screen resolution is. How can I do this. Any suggestions is appreciated. Here is my XML <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns

Layout duplicating itself on screen rotation

穿精又带淫゛_ 提交于 2021-02-07 05:37:27
问题 I have a layout that has an EditText and a Button. I <include> it in my main layout. I'm having a weird issue with the layout and rotation. It seems to duplicate itself when the device (physical) is rotated, messing up the text and layout. Here it is on first open, after I add some extra garble: DSC_0013 is in the EditText on launch of the fragment. Then, I rotate the phone and add some different garble: And you can see the issue pretty clearly. At first, I thought it was just the EditText

how to create a circular imageButton in android? [duplicate]

爷,独闯天下 提交于 2021-02-07 04:56:24
问题 This question already has answers here : Custom circle button (10 answers) Closed 6 years ago . Guys i have created a imageButton in my layout file and set a circular png image as its background.but when i am running my application, its displaying me a square button with my given image placed in the middle of it. <ImageButton android:id="@+id/imageButton1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout

custom seekbar with multi color

无人久伴 提交于 2021-02-07 03:25:53
问题 I am trying to create custom seek bar in android with multicolor. I tried below code customseekbar.java int proBarWidth = getWidth(); int proBarHeight = getHeight(); int thumboffset = getThumbOffset(); int lastproX = 0; int proItemWidth, proItemRight; for (int i = 0; i < mproItemsList.size(); i++) { proItem proItem = mproItemsList.get(i); Paint proPaint = new Paint(); proPaint.setColor(getResources().getColor(proItem.color)); proItemWidth = (int) (proItem.proItemPercentage * proBarWidth / 100