android-layout

Webview shows blank screen

本秂侑毒 提交于 2020-01-17 03:05:30
问题 I know the question may be redundant but I've tried many solutions and nothing could have helped me. In my app, once the user is clicking on a button, it transfers the user to another page. On this page I have a Webview, and a button. They are defined in my xml file as follows: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical"

Android stretches the layout file instead of loading the correct file in the res folders

一曲冷凌霜 提交于 2020-01-17 02:43:26
问题 I have a handset version of an activity and a tablet version of the same activity. My handset version is res/layout/activity.xml while my 7' tablet version is res/layout-sw600dp/activity.xml The thing is that when I run the app in a 7' tablet, not only does it not load the xml file in res/layout-sw600dp , but it displays a stretched version of the layout in the res/layout folder. So, everything from buttons, images, as well as the action bar itself is simply stretched and distorted to fill

Rounding the corners of views in notepad android app

蓝咒 提交于 2020-01-17 00:33:27
问题 I currently have this user interface on my app. I would like to round the edges of the notes like I managed to do in the composing section of the app, as below I was able to do this by using the following in a file in drawable called timetable_item_border.xml, <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > <stroke android:width="0dp" android:color="#000" /> <solid android:color="@color/tile_background" />

startActivityForResult from ActivityGroup

自闭症网瘾萝莉.ら 提交于 2020-01-16 19:28:05
问题 I am using ActivityGroup. I use the following code from ActivityGroup in order to replace view and launch a new activity. Intent i = new Intent(SummaryCostScreen.this,PermissionsScreen.class); replaceContentView("activity1",i); public void replaceContentView(String id, Intent newIntent) { View view = getLocalActivityManager().startActivity(id, newIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)).getDecorView(); } The problem with the above code is that, I need to have startActivityForResult in

How to set a max height of a any kind of view?

泄露秘密 提交于 2020-01-16 19:18:53
问题 Background I'm trying to put a view within a container view, so that the container will allow the view to have any height (and/or width,depending on your specification) , yet not pass a specific one. The problem There is no way to define "maxHeight" for any kind of view. You can only use exact size , use some tricks to take the spare size (layout_weight) or make the scrollView take as much space as it needs. The only similar thing is for EditText , which you can use "maxLines" together with

Android Layout_Weight for Fixed Width Not Working

懵懂的女人 提交于 2020-01-16 19:14:25
问题 I'm trying to use layout_weight and layout_width with a linear layout with horizontal orientation. The linear layout contains 1 TextView and 2 RadioButtons (in a RadioButtonGroup). I'd like the TextView to fill up the space to the left of the RadioButtons and always keep the RadioButtons right-justified on the screen. So regardless of the amount of text, the TextView should take up the space so that the RadioButtons are always right-justified. The LinearLayout is used in a ListView to have

Implement view clicks on multiple ViewHolder types in RecycleView adapter

妖精的绣舞 提交于 2020-01-16 18:10:07
问题 I am implementing multiple ViewHolders as suggested in this answer which uses an abstract bind() . My current Adapter and ViewHolder looks likes: // MyAdapter.java {adapter code} public static abstract class MyViewHolder extends RecyclerView.ViewHolder { public MyViewHolder(View itemView) { super(itemView); } protected abstract void bind(MyModel item); } // ViewHolder1.java public class ViewHolder1 extends MyAdapter.MyViewHolder implements View.OnClickListener { TextView textView; public

How to word wrap the hint of a single line AutoCompleteTextView?

与世无争的帅哥 提交于 2020-01-16 14:31:51
问题 I have an AutoCompleteTextView where the user is to write in a single-line search, i.e. no line breaks are allowed. Using android:singleLine="true" allows this to work properly. However, I also wish to set a hint to display when no other text has been entered, and this text does require more than one line. My problem is that with Android 4+, the hint is not wrapped to several lines. With Android 2.3, however, the content does get wrapped and multiple lines are displayed. Users are still not

How to word wrap the hint of a single line AutoCompleteTextView?

送分小仙女□ 提交于 2020-01-16 14:31:16
问题 I have an AutoCompleteTextView where the user is to write in a single-line search, i.e. no line breaks are allowed. Using android:singleLine="true" allows this to work properly. However, I also wish to set a hint to display when no other text has been entered, and this text does require more than one line. My problem is that with Android 4+, the hint is not wrapped to several lines. With Android 2.3, however, the content does get wrapped and multiple lines are displayed. Users are still not

Android custom dialog gives an error

筅森魡賤 提交于 2020-01-16 14:22:06
问题 In my android app I have to popup a dialog on a button click event . But when I click on the button the app stops working. I load the pre designed layout into the dialog. I will post a code segment. Button login = (Button) findViewById(R.id.btn_login); login.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { final Dialog dialog = new Dialog(getApplication()); dialog.setContentView(R.layout.journey_details); dialog.setTitle("Android Custom Dialog Box"); Button